public function testReadFilesEsQueryFilterRunId()
 {
     $root = $this->tmpDir;
     file_put_contents($root . "/upload", "test");
     $reader = new Reader($this->client);
     $fo = new FileUploadOptions();
     $fo->setTags(["docker-bundle-test"]);
     $this->client->setRunId('xyz');
     $id1 = $this->client->uploadFile($root . "/upload", $fo);
     $id2 = $this->client->uploadFile($root . "/upload", $fo);
     $this->client->setRunId('1234567');
     $id3 = $this->client->uploadFile($root . "/upload", $fo);
     $id4 = $this->client->uploadFile($root . "/upload", $fo);
     $this->client->setRunId('1234567.8901234');
     $id5 = $this->client->uploadFile($root . "/upload", $fo);
     $id6 = $this->client->uploadFile($root . "/upload", $fo);
     $configuration = [["query" => "tags: docker-bundle-test", "filter_by_run_id" => true]];
     $reader->downloadFiles($configuration, $root . "/download");
     $this->assertFalse(file_exists($root . "/download/" . $id1 . '_upload'));
     $this->assertFalse(file_exists($root . "/download/" . $id2 . '_upload'));
     $this->assertTrue(file_exists($root . "/download/" . $id3 . '_upload'));
     $this->assertTrue(file_exists($root . "/download/" . $id4 . '_upload'));
     $this->assertTrue(file_exists($root . "/download/" . $id5 . '_upload'));
     $this->assertTrue(file_exists($root . "/download/" . $id6 . '_upload'));
 }
Example #2
0
 /**
  * @param $source
  * @param array $config
  * @throws \Keboola\StorageApi\ClientException
  */
 protected function uploadFile($source, $config = array())
 {
     $options = new FileUploadOptions();
     $options->setTags(array_unique($config["tags"]))->setIsPermanent($config["is_permanent"])->setIsEncrypted($config["is_encrypted"])->setIsPublic($config["is_public"])->setNotify($config["notify"]);
     $this->getClient()->uploadFile($source, $options);
 }