Skip to content

Commit

Permalink
feat: multi-tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Oct 17, 2023
1 parent 992841b commit a771c53
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void select() throws Exception {
@Test
void inputOutputFiles() throws Exception {
URI source = storageInterface.put(
null,
new URI("/" + IdUtils.create()),
new FileInputStream(new File(Objects.requireNonNull(DuckDbTest.class.getClassLoader()
.getResource("full.csv"))
Expand All @@ -199,7 +200,7 @@ void inputOutputFiles() throws Exception {
System.out.println(JacksonMapper.ofYaml().writeValueAsString(task));

assertThat(
IOUtils.toString(storageInterface.get(runOutput.getOutputFiles().get("out")), Charsets.UTF_8),
IOUtils.toString(storageInterface.get(null, runOutput.getOutputFiles().get("out")), Charsets.UTF_8),
is( "id,name\n" +
"4814976,Viva\n" +
"1010871,Voomm\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void load() throws Exception {
URL resource = LoadTest.class.getClassLoader().getResource("load.csv");

URI put = storageInterface.put(
null,
new URI("/file/storage/get.yml"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -91,7 +91,7 @@ public void namedInsert() throws Exception {

}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -122,7 +122,7 @@ public void namedColumnsInsert() throws Exception {
}


URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

ArrayList<String> columns = new ArrayList<>();
columns.add("t_id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -154,7 +154,7 @@ public void namedInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(TestUtils.url())
Expand Down Expand Up @@ -191,7 +191,7 @@ public void namedColumnsInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(TestUtils.url())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void selectAndFetchToFile() throws Exception {
AbstractJdbcQuery.Output runOutput = task.run(runContext);
assertThat(runOutput.getUri(), notNullValue());

BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.storageInterface.get(runOutput.getUri())));
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.storageInterface.get(null, runOutput.getUri())));
int lines = 0;
while (bufferedReader.readLine() != null) {
lines++;
Expand Down Expand Up @@ -208,6 +208,7 @@ void selectWithCompositeType() throws Exception {
@Test
void updateFromFlow() throws Exception {
Execution execution = runnerUtils.runOne(
null,
"io.kestra.jdbc.postgres",
"update_postgres",
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void success() throws Exception {
URL resource = UploadDownloadTest.class.getClassLoader().getResource("scripts/snowflake.sql");

URI put = storageInterface.put(
null,
new URI("/file/storage/snowflake.sql"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
Expand Down Expand Up @@ -82,8 +83,8 @@ void success() throws Exception {
assertThat(downloadRun.getUri(), notNullValue());

assertThat(
IOUtils.toString(this.storageInterface.get(downloadRun.getUri()), Charsets.UTF_8),
is(IOUtils.toString(this.storageInterface.get(put), Charsets.UTF_8))
IOUtils.toString(this.storageInterface.get(null, downloadRun.getUri()), Charsets.UTF_8),
is(IOUtils.toString(this.storageInterface.get(null, put), Charsets.UTF_8))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void insert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -94,7 +94,7 @@ public void namedInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -125,7 +125,7 @@ public void namedColumnsInsert() throws Exception {
}


URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

ArrayList<String> columns = new ArrayList<>();
columns.add("t_id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -123,7 +123,7 @@ public void namedInsert() throws Exception {
}


URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -174,7 +174,7 @@ public void namedColumnsInsert() throws Exception {

}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -103,7 +103,7 @@ public void namedInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -134,7 +134,7 @@ public void namedColumnsInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down

0 comments on commit a771c53

Please sign in to comment.