Skip to content

Commit

Permalink
feat: storage now have a namespace parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Nov 21, 2024
1 parent 4222c43 commit e00feb1
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 32 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=0.20.0-SNAPSHOT
kestraVersion=[0.18,)
kestraVersion=[0.20,)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
import io.kestra.core.runners.RunContext;
import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.storages.StorageInterface;
import io.kestra.plugin.aws.AbstractLocalStackTest;
import io.kestra.core.junit.annotations.KestraTest;
import jakarta.inject.Inject;
Expand All @@ -17,9 +16,6 @@ public abstract class AbstractDynamoDbTest extends AbstractLocalStackTest {
@Inject
protected RunContextFactory runContextFactory;

@Inject
protected StorageInterface storageInterface;

void createTable(RunContext runContext, AbstractDynamoDb dynamoDb) throws IllegalVariableEvaluationException {
try (var dynamoDbClient = dynamoDb.client(runContext)) {
if (!dynamoDbClient.listTables().tableNames().contains("persons")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.kestra.core.runners.RunContext;
import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.serializers.FileSerde;
import io.kestra.core.storages.StorageInterface;
import io.kestra.plugin.aws.AbstractLocalStackTest;
import io.kestra.plugin.aws.eventbridge.model.Entry;
import io.kestra.core.junit.annotations.KestraTest;
Expand All @@ -15,8 +14,6 @@
import lombok.extern.jackson.Jacksonized;
import org.junit.jupiter.api.Test;
import org.testcontainers.junit.jupiter.Testcontainers;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -36,8 +33,6 @@ class PutEventsTest extends AbstractLocalStackTest {

@Inject
protected RunContextFactory runContextFactory;
@Inject
protected StorageInterface storageInterface;

private static List<PutEvents.OutputEntry> getOutputEntries(PutEvents put, RunContext runContext) throws Exception {
var output = put.run(runContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.serializers.FileSerde;
import io.kestra.core.serializers.JacksonMapper;
import io.kestra.core.storages.StorageInterface;
import io.kestra.plugin.aws.AbstractLocalStackTest;
import io.kestra.plugin.aws.kinesis.model.Record;
import io.kestra.core.junit.annotations.KestraTest;
Expand All @@ -23,8 +22,6 @@
import org.testcontainers.containers.localstack.LocalStackContainer;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
Expand Down Expand Up @@ -52,8 +49,6 @@ class PutRecordsTest {

@Inject
protected RunContextFactory runContextFactory;
@Inject
protected StorageInterface storageInterface;

@BeforeAll
static void startLocalstack() throws IllegalVariableEvaluationException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.kestra.plugin.aws.lambda;

import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.storages.StorageInterface;
import io.kestra.plugin.aws.AbstractLocalStackTest;
import io.kestra.core.junit.annotations.KestraTest;
import jakarta.inject.Inject;
Expand All @@ -16,7 +15,6 @@
import software.amazon.awssdk.services.lambda.waiters.LambdaWaiter;

import java.io.InputStream;
import java.util.stream.Collectors;

@KestraTest
@Testcontainers
Expand All @@ -33,11 +31,6 @@ public class AbstractInvokeTest extends AbstractLocalStackTest {
@Inject
protected RunContextFactory runContextFactory;

@Inject
protected StorageInterface storageInterface;

protected String functionArn;


void createFunction(LambdaClient client) {
if (client.listFunctions().functions().stream().noneMatch(config -> config.functionName().equals(FUNCTION_NAME))) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/kestra/plugin/aws/s3/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -64,6 +63,7 @@ protected String upload(String dir) throws Exception {

protected URI storagePut(String path) throws URISyntaxException, IOException {
return storageInterface.put(
null,
null,
new URI("/" + (path != null ? path : IdUtils.create())),
new FileInputStream(file())
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/kestra/plugin/aws/s3/AllTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void run() throws Exception {
.build();
Download.Output run = download.run(runContext(download));

InputStream get = storageInterface.get(null, run.getUri());
InputStream get = storageInterface.get(null, null, run.getUri());
assertThat(
CharStreams.toString(new InputStreamReader(get)),
is(CharStreams.toString(new InputStreamReader(new FileInputStream(file()))))
Expand Down
4 changes: 0 additions & 4 deletions src/test/java/io/kestra/plugin/aws/sns/AbstractSnsTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.kestra.plugin.aws.sns;

import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.storages.StorageInterface;
import io.kestra.plugin.aws.AbstractLocalStackTest;
import io.kestra.core.junit.annotations.KestraTest;
import jakarta.inject.Inject;
Expand All @@ -17,9 +16,6 @@ public class AbstractSnsTest extends AbstractLocalStackTest {
@Inject
protected RunContextFactory runContextFactory;

@Inject
protected StorageInterface storageInterface;

void createTopic(SnsClient client) {
if (!client.listTopics().topics().contains(TOPIC_ARN)) {
client.createTopic(CreateTopicRequest.builder().name("test-topic").build());
Expand Down
4 changes: 0 additions & 4 deletions src/test/java/io/kestra/plugin/aws/sqs/AbstractSqsTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.kestra.plugin.aws.sqs;

import io.kestra.core.runners.RunContextFactory;
import io.kestra.core.storages.StorageInterface;
import io.kestra.plugin.aws.AbstractLocalStackTest;
import io.kestra.core.junit.annotations.KestraTest;
import jakarta.inject.Inject;
Expand All @@ -21,9 +20,6 @@ public class AbstractSqsTest extends AbstractLocalStackTest {
@Inject
protected RunContextFactory runContextFactory;

@Inject
protected StorageInterface storageInterface;

@BeforeEach
void beforeEach() {
try(SqsClient sqsClient = SqsClient
Expand Down

0 comments on commit e00feb1

Please sign in to comment.