Skip to content

Commit

Permalink
[FLINK-33259][ci] Use common workflow for ci builds
Browse files Browse the repository at this point in the history
  • Loading branch information
z3d1k committed Nov 1, 2023
1 parent 0243540 commit 9280023
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:
cancel-in-progress: true
jobs:
compile_and_test:
uses: ./.github/workflows/common.yml
uses: apache/flink-connector-shared-utils/.github/workflows/ci.yml@ci_utils
strategy:
matrix:
flink: [1.17.1, 1.18.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.flink.connector.aws.util.AWSGeneralUtil;
import org.apache.flink.connector.kinesis.testutils.AWSEndToEndTestUtils;
import org.apache.flink.connector.kinesis.testutils.AWSKinesisResourceManager;
import org.apache.flink.connector.kinesis.testutils.RequiresAwsCredentials;
import org.apache.flink.runtime.client.JobExecutionException;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
Expand All @@ -33,8 +34,6 @@
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.Execution;
Expand All @@ -52,8 +51,8 @@
/** End-to-end tests for Kinesis Data Streams Sink. */
@ExtendWith(MiniClusterExtension.class)
@Execution(ExecutionMode.CONCURRENT)
@Tag("requires-aws-credentials")
@Disabled
@RequiresAwsCredentials
// @Disabled
class KinesisStreamsSinkITCase {

private static final String DEFAULT_FIRST_SHARD_NAME = "shardId-000000000000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.flink.connector.aws.util.AWSGeneralUtil;
import org.apache.flink.util.Preconditions;

import com.google.common.base.Strings;
import software.amazon.awssdk.awscore.client.builder.AwsClientBuilder;
import software.amazon.awssdk.awscore.client.builder.AwsSyncClientBuilder;
import software.amazon.awssdk.core.SdkClient;
Expand Down Expand Up @@ -62,11 +63,11 @@ public static Properties createTestConfig() {
}

private static void configureTestCredentials(Properties config) {
Preconditions.checkNotNull(
System.getenv("FLINK_AWS_USER"),
Preconditions.checkArgument(
!Strings.isNullOrEmpty(System.getenv("FLINK_AWS_USER")),
"FLINK_AWS_USER not configured for end to end test.");
Preconditions.checkNotNull(
System.getenv("FLINK_AWS_PASSWORD"),
Preconditions.checkArgument(
!Strings.isNullOrEmpty(System.getenv("FLINK_AWS_PASSWORD")),
"FLINK_AWS_PASSWORD not configured for end to end test.");
config.setProperty(
AWSConfigConstants.accessKeyId(AWS_CREDENTIALS_PROVIDER),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.apache.flink.connector.kinesis.testutils;

import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* The {@code RequiresAwsCredentials} annotation is used to indicate that a method or a class
* requires AWS credentials to be provided as environment variables. This annotation can be applied
* to both methods and classes.
*
* <p>Note that in order to use this annotation, the following environment variables must be set:
*
* <ul>
* <li>FLINK_AWS_USER: The AWS user name.
* <li>FLINK_AWS_PASSWORD: The AWS password.
* </ul>
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@EnabledIfEnvironmentVariable(named = "FLINK_AWS_USER", matches = ".+")
@EnabledIfEnvironmentVariable(named = "FLINK_AWS_PASSWORD", matches = ".+")
public @interface RequiresAwsCredentials {}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@

import org.apache.flink.connector.aws.testutils.AWSServicesTestUtils;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.http.SdkHttpClient;
import software.amazon.awssdk.services.kinesis.KinesisClient;

/** Dummy test to clean up stale resources. */
@Tag("requires-aws-credentials")
@RequiresAwsCredentials
public class StaleResourceCleanupITCase {
@Test
void cleanUpStaleKinesisStreams() {
Expand Down

0 comments on commit 9280023

Please sign in to comment.