Skip to content

Commit 4eca4a4

Browse files
authored
OSS changes to support acceptance test on data plane (#20853)
* addlog * fix applicaion.yml * remove logging * var name for boolean * test setup * test * more fix for testing * self review * remove unrelated changes * remove unwanted cdk changes * more clean ups
1 parent b776a2d commit 4eca4a4

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

airbyte-test-utils/src/main/java/io/airbyte/test/utils/AirbyteAcceptanceTestHarness.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import io.airbyte.api.client.model.generated.DestinationIdRequestBody;
3535
import io.airbyte.api.client.model.generated.DestinationRead;
3636
import io.airbyte.api.client.model.generated.DestinationSyncMode;
37+
import io.airbyte.api.client.model.generated.Geography;
3738
import io.airbyte.api.client.model.generated.JobConfigType;
3839
import io.airbyte.api.client.model.generated.JobDebugInfoRead;
3940
import io.airbyte.api.client.model.generated.JobIdRequestBody;
@@ -490,6 +491,18 @@ public ConnectionRead createConnection(final String name,
490491
final ConnectionScheduleType scheduleType,
491492
final ConnectionScheduleData scheduleData)
492493
throws ApiException {
494+
return createConnectionWithGeography(name, sourceId, destinationId, operationIds, catalog, scheduleType, scheduleData, Geography.AUTO);
495+
}
496+
497+
public ConnectionRead createConnectionWithGeography(final String name,
498+
final UUID sourceId,
499+
final UUID destinationId,
500+
final List<UUID> operationIds,
501+
final AirbyteCatalog catalog,
502+
final ConnectionScheduleType scheduleType,
503+
final ConnectionScheduleData scheduleData,
504+
final Geography geography)
505+
throws ApiException {
493506
final ConnectionRead connection = apiClient.getConnectionApi().createConnection(
494507
new ConnectionCreate()
495508
.status(ConnectionStatus.ACTIVE)
@@ -502,7 +515,8 @@ public ConnectionRead createConnection(final String name,
502515
.name(name)
503516
.namespaceDefinition(NamespaceDefinitionType.CUSTOMFORMAT)
504517
.namespaceFormat(OUTPUT_NAMESPACE)
505-
.prefix(OUTPUT_STREAM_PREFIX));
518+
.prefix(OUTPUT_STREAM_PREFIX)
519+
.geography(geography));
506520
connectionIds.add(connection.getConnectionId());
507521
return connection;
508522
}

airbyte-workers/src/main/java/io/airbyte/workers/config/ApiClientBeanFactory.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@ public HttpClient httpClient() {
7474

7575
@Singleton
7676
@Named("internalApiScheme")
77-
public String internalApiScheme(final Environment environment) {
77+
public String internalApiScheme(@Value("${airbyte.acceptance.test.enabled}") final boolean isInTestMode, final Environment environment) {
7878
// control plane workers communicate with the Airbyte API within their internal network, so https
7979
// isn't needed
80+
if (isInTestMode) {
81+
return "http";
82+
}
8083
return environment.getActiveNames().contains(WorkerMode.CONTROL_PLANE) ? "http" : "https";
8184
}
8285

@@ -97,8 +100,9 @@ public String internalApiAuthToken(
97100
@Value("${airbyte.control.plane.auth-endpoint}") final String controlPlaneAuthEndpoint,
98101
@Value("${airbyte.data.plane.service-account.email}") final String dataPlaneServiceAccountEmail,
99102
@Value("${airbyte.data.plane.service-account.credentials-path}") final String dataPlaneServiceAccountCredentialsPath,
103+
@Value("${airbyte.acceptance.test.enabled}") final boolean isInTestMode,
100104
final Environment environment) {
101-
if (environment.getActiveNames().contains(WorkerMode.CONTROL_PLANE)) {
105+
if (isInTestMode || environment.getActiveNames().contains(WorkerMode.CONTROL_PLANE)) {
102106
// control plane workers communicate with the Airbyte API within their internal network, so a signed
103107
// JWT isn't needed
104108
return airbyteApiAuthHeaderValue;

airbyte-workers/src/main/java/io/airbyte/workers/config/SecretPersistenceBeanFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.airbyte.commons.temporal.config.WorkerMode;
88
import io.airbyte.config.persistence.split_secrets.GoogleSecretManagerPersistence;
99
import io.airbyte.config.persistence.split_secrets.LocalTestingSecretPersistence;
10+
import io.airbyte.config.persistence.split_secrets.NoOpSecretsHydrator;
1011
import io.airbyte.config.persistence.split_secrets.RealSecretsHydrator;
1112
import io.airbyte.config.persistence.split_secrets.SecretPersistence;
1213
import io.airbyte.config.persistence.split_secrets.SecretsHydrator;
@@ -68,6 +69,15 @@ public SecretPersistence vaultSecretPersistence(@Value("${airbyte.secret.store.v
6869
}
6970

7071
@Singleton
72+
@Requires(property = "airbyte.acceptance.test.enabled",
73+
value = "true")
74+
public SecretsHydrator noOpSecretsHydrator() {
75+
return new NoOpSecretsHydrator();
76+
}
77+
78+
@Singleton
79+
@Requires(property = "airbyte.acceptance.test.enabled",
80+
value = "false")
7181
public SecretsHydrator secretsHydrator(@Named("secretPersistence") final SecretPersistence secretPersistence) {
7282
return new RealSecretsHydrator(secretPersistence);
7383
}

airbyte-workers/src/main/resources/application.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ airbyte:
1616
max-attempts: ${ACTIVITY_MAX_ATTEMPT:5}
1717
max-delay: ${ACTIVITY_MAX_DELAY_BETWEEN_ATTEMPTS_SECONDS:600}
1818
max-timeout: ${ACTIVITY_MAX_TIMEOUT_SECOND:120}
19+
acceptance:
20+
test:
21+
enabled: ${ACCEPTANCE_TEST_ENABLED:false}
1922
cloud:
2023
storage:
2124
logs:

0 commit comments

Comments
 (0)