/** * @expectedException \Exception * @expectedExceptionMessage Found orphaned file manifest: 'file1.manifest' */ public function testWriteFilesOrphanedManifest() { $root = $this->tmp->getTmpFolder(); file_put_contents($root . "/upload/file1.manifest", "tags: [\"tde-exporter-php-test-xxx\"]\nis_public: true"); $writer = new Uploader($this->client); $writer->uploadFiles($root . "/upload"); }
public function testCleanupForeignFile() { $temp = new Temp(); $temp->initRunFolder(); $dir = $temp->getTmpFolder(); touch($dir . '/file'); self::assertFileExists($dir . '/file'); unset($temp); self::assertFileNotExists($dir); }
public function setUp() { // Create folders $temp = new Temp('docker'); $temp->initRunFolder(); $this->temp = $temp; $this->tmpDir = $temp->getTmpFolder(); $fs = new Filesystem(); $fs->mkdir($this->tmpDir . "/download"); $this->client = new Client(["token" => STORAGE_API_TOKEN]); }
public function testCreateSandboxInputMapping() { $temp = new Temp(); $tmpDir = $temp->getTmpFolder(); $temp->initRunFolder(); $csv = new CsvFile($tmpDir . "/upload.csv"); $csv->writeRow(["Id", "Name"]); $csv->writeRow(["test", "test"]); $this->client->createTableAsync("in.c-sandbox", "test", $csv); unset($csv); $this->createECSServer(); $jobData = ['params' => ['backend' => 'docker', 'type' => 'rstudio', 'input' => ['tables' => [['source' => 'in.c-sandbox.test', 'destination' => 'source.csv']]]]]; $data = $this->executeJob('create', $jobData); $this->assertArrayHasKey('credentials', $data); $this->assertArrayHasKey('id', $data['credentials']); $doctrine = self::$kernel->getContainer()->get("doctrine"); $server = new Docker($doctrine, new Client(["token" => "dummy"])); $account = $server->getActiveAccount($data["credentials"]["id"]); /** @var $account \Keboola\ProvisioningBundle\Entity\Account\Docker */ $this->assertNotEmpty($account->getCredentials()); $credentials = $account->getCredentials(); $this->assertArrayHasKey('hostname', $credentials); $this->assertArrayHasKey('port', $credentials); $this->assertArrayHasKey('user', $credentials); $this->assertArrayHasKey('password', $credentials); $client = $this->getGuzzleClient(); $url = $credentials['hostname'] . ':' . $credentials['port']; $res = $client->request('GET', $url); $response = (string) $res->getBody(); $this->assertContains('RStudio: Browser Not Supported', $response); }