diff --git a/.circleci/config.yml b/.circleci/config.yml index a35576539a..4c28d36f1b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,6 +43,11 @@ jobs: # needed for .withReuse(true) to work echo "testcontainers.reuse.enable=true" > ~/.testcontainers.properties - checkout + - restore_cache: + keys: + - spring-cloud-kubernetes-{{ .Branch }}-{{ checksum "pom.xml" }} + - spring-cloud-kubernetes-{{ .Branch }} + - spring-cloud-kubernetes - attach_workspace: at: /tmp/docker - run: @@ -60,19 +65,74 @@ jobs: ########################################################################################################################### ################################################# Build test support dependency ########################################### cd spring-cloud-kubernetes-test-support - .././mvnw clean install + .././mvnw clean install cd .. ########################################################################################################################### ##################################################### Split and run tests ################################################# - CLASSNAMES=$(circleci tests glob "**/src/test/**/**.java" | grep -v 'Fabric8IstioIT' \ - | xargs grep -l '@Test' \ - | sed 's/.*src.test.java.//g' | sed 's@/@.@g' \ - | sed 's/.\{5\}$//' \ - | circleci tests split --split-by=timings) - echo $CLASSNAMES - TEST_ARG=$(echo $CLASSNAMES | sed 's/ /,/g') - echo $TEST_ARG + + # - find all tests + # - exclude Fabric8IstionIT + # - only take classes that have @Test inside them + # - ignore the ones that have 'abstract class'. we do this because otherwise we would pass + # to -DtestsToRun an abstract class, and it will not run anything. + # - drop the "begining" xxx/src/test/java + # - replace / with . + # - drop last ".java" + # - replace newline with space + + PLAIN_TEST_CLASSNAMES=($(find . -name '*.java' \ + | grep 'src/test/java' \ + | grep -v 'Fabric8IstioIT' \ + | xargs grep -l '@Test' \ + | xargs grep -L 'abstract class' \ + | sed 's/.*src.test.java.//g' \ + | sed 's@/@.@g' \ + | sed 's/.\{5\}$//')) + + # classes that have @Test and are abstract, for example: "LabeledSecretWithPrefixTests" + # - exclude Fabric8IstionIT + # - only take classes that have @Test inside them + # - only take classes that are abstract + # - drop everything up until the last "/" + # - drop ".java" + + ABSTRACT_TEST_CLASSNAMES_COMMAND="find . -name '*.java' \ + | grep 'src/test/java' \ + | grep -v 'Fabric8IstioIT' \ + | xargs grep -l '@Test' \ + | xargs grep -l 'abstract class' \ + | sed 's/.*\///g' \ + | sed 's/.java//g'" + + # find classes that extend abstract test classes + DERIVED_FROM_ABSTRACT_CLASSES_COMMAND="find . -name '*.java' \ + | grep 'src/test/java' \ + | grep -v 'Fabric8IstioIT' \ + | xargs grep -l 'extends replace_me ' \ + | sed 's/.*src.test.java.//g' \ + | sed 's@/@.@g' \ + | sed 's/.\{5\}$//'" + + while read class_name; do + replaced=$(echo ${DERIVED_FROM_ABSTRACT_CLASSES_COMMAND/replace_me/"$class_name"}) + result=($(eval $replaced)) + PLAIN_TEST_CLASSNAMES+=(${result[@]}) + done < <(eval $ABSTRACT_TEST_CLASSNAMES_COMMAND) + + IFS=$'\n' + SORTED_TEST_CLASSNAMES=( $(sort \<<< "${PLAIN_TEST_CLASSNAMES[*]}" | uniq -u) ) + unset IFS + + printf "%s\n" "${SORTED_TEST_CLASSNAMES[@]}" > file.txt + CLASSNAMES=( $(cat file.txt | circleci tests split --split-by=timings) ) + rm file.txt + + TEST_ARG=$(echo ${CLASSNAMES[@]} | sed 's/ /,/g') + echo '----------------------- tests ---------------------' + echo ${TEST_ARG[@]} + echo '---------------------------------------------------' + ./mvnw -s .settings.xml -DfailIfNoTests=false -DtestsToRun=$TEST_ARG -e clean org.jacoco:jacoco-maven-plugin:prepare-agent install \ -U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn @@ -110,7 +170,7 @@ jobs: - run: name: dependencies command: | - ./mvnw -s .settings.xml -U dependency:resolve-plugins dependency:go-offline -B -Dservice.occurence=${_SERVICE_OCCURENCE} || true + ./mvnw -s .settings.xml -U dependency:resolve-plugins dependency:go-offline -B || true - run: name: build command: | diff --git a/.github/workflows/composites/build-controllers-project/action.yaml b/.github/workflows/composites/build-controllers-project/action.yaml new file mode 100644 index 0000000000..0b11f0a445 --- /dev/null +++ b/.github/workflows/composites/build-controllers-project/action.yaml @@ -0,0 +1,11 @@ +name: build controllers project +description: build controllers project +runs: + using: "composite" + steps: + - name: build controllers project + shell: bash + run: | + cd spring-cloud-kubernetes-controllers + .././mvnw -T 1C clean install + cd .. diff --git a/.github/workflows/composites/build-integration-tests-project/action.yaml b/.github/workflows/composites/build-integration-tests-project/action.yaml new file mode 100644 index 0000000000..ffed7a1ddd --- /dev/null +++ b/.github/workflows/composites/build-integration-tests-project/action.yaml @@ -0,0 +1,12 @@ +name: build integration tests project without tests +description: build integration tests project without tests +runs: + using: "composite" + steps: + - name: build integration tests project without tests + shell: bash + run: | + cd spring-cloud-kubernetes-integration-tests + # build the images, but dont run the tests + .././mvnw -T 1C clean install -DskipTests + cd .. diff --git a/.github/workflows/composites/cache/action.yaml b/.github/workflows/composites/cache/action.yaml new file mode 100644 index 0000000000..b823306e5c --- /dev/null +++ b/.github/workflows/composites/cache/action.yaml @@ -0,0 +1,11 @@ +name: cache +description: cache +runs: + using: "composite" + steps: + - uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-cache-${{ env.BRANCH_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-cache-${{ env.BRANCH_NAME }}-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/composites/download-docker-images/action.yaml b/.github/workflows/composites/download-docker-images/action.yaml new file mode 100644 index 0000000000..038d2c6586 --- /dev/null +++ b/.github/workflows/composites/download-docker-images/action.yaml @@ -0,0 +1,15 @@ +# we are not going to use upload/download actions, since it is slower than cache usage +# as key to the cache we are going to use DOCKER_IMAGES_KEY, which is the same as GITHUB_RUN_ID + +name: download docker images +description: download docker images +runs: + using: "composite" + steps: + - uses: actions/cache@v2 + with: + path: /tmp/docker/images + key: docker-images-cache-${{ env.DOCKER_IMAGES_KEY }} + restore-keys: docker-images-cache-${{ env.DOCKER_IMAGES_KEY }} + + diff --git a/.github/workflows/composites/echo-saved-images/action.yaml b/.github/workflows/composites/echo-saved-images/action.yaml new file mode 100644 index 0000000000..7b5ff3fb20 --- /dev/null +++ b/.github/workflows/composites/echo-saved-images/action.yaml @@ -0,0 +1,10 @@ +name: echo saved images +description: echo saved images +runs: + using: "composite" + steps: + - name: echo saved images + shell: bash + run: | + VIEW=$(ls -l /tmp/docker/images) + echo "${VIEW}" diff --git a/.github/workflows/composites/env-variables/action.yaml b/.github/workflows/composites/env-variables/action.yaml new file mode 100644 index 0000000000..9adb9ebf41 --- /dev/null +++ b/.github/workflows/composites/env-variables/action.yaml @@ -0,0 +1,10 @@ +name: sets environment variables +description: sets environment variables +runs: + using: "composite" + steps: + - name: set env variables + shell: bash + run: | + echo "BRANCH_NAME=$(echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV + echo "DOCKER_IMAGES_KEY=$(echo $GITHUB_RUN_ID)" >> $GITHUB_ENV diff --git a/.github/workflows/composites/fabric8-istio-integration-test/action.yaml b/.github/workflows/composites/fabric8-istio-integration-test/action.yaml new file mode 100644 index 0000000000..5f410c33f9 --- /dev/null +++ b/.github/workflows/composites/fabric8-istio-integration-test/action.yaml @@ -0,0 +1,12 @@ +name: run fabric8 istio integration test +description: run fabric8 istio integration test +runs: + using: "composite" + steps: + - name: run fabric8 istio integration test + shell: bash + run: | + docker load -i /tmp/docker/images/spring-cloud-kubernetes-fabric8-istio-it.tar + cd spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/ + ../.././mvnw clean install -Dskip.build.image=true + cd ../.. diff --git a/.github/workflows/composites/fabric8-istio/action.yaml b/.github/workflows/composites/fabric8-istio/action.yaml new file mode 100644 index 0000000000..5b05369628 --- /dev/null +++ b/.github/workflows/composites/fabric8-istio/action.yaml @@ -0,0 +1,14 @@ +# build a lightweight project so that dependencies for the +# maven-surefire-plugin are downloaded and thus cached also + +name: build fabric8 istio project +description: build fabric8 istio projects +runs: + using: "composite" + steps: + - name: build fabric8 istio project + shell: bash + run: | + cd spring-cloud-kubernetes-fabric8-istio + .././mvnw -s ../.settings.xml clean install -U + cd .. diff --git a/.github/workflows/composites/load-docker-images/action.yaml b/.github/workflows/composites/load-docker-images/action.yaml new file mode 100644 index 0000000000..6ebb7651d6 --- /dev/null +++ b/.github/workflows/composites/load-docker-images/action.yaml @@ -0,0 +1,22 @@ +name: install docker images +description: load docker images from tar +runs: + using: "composite" + steps: + - name: load docker images + shell: bash + run: | + + # get the name of the images to load from children of spring-cloud-kubernetes-controllers + cd spring-cloud-kubernetes-controllers + while read controller_image; do + docker load -i /tmp/docker/images/${controller_image}.tar + done < <(mvn -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q | grep -v 'spring-cloud-kubernetes-controllers') + cd .. + + # get the name of the images to load from children of spring-cloud-kubernetes-integration-tests + cd spring-cloud-kubernetes-integration-tests + while read integration_test_image; do + docker load -i /tmp/docker/images/${integration_test_image}.tar + done < <(mvn -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q | grep -v 'spring-cloud-kubernetes-integration-tests') + cd .. diff --git a/.github/workflows/composites/save-controller-images/action.yaml b/.github/workflows/composites/save-controller-images/action.yaml new file mode 100644 index 0000000000..056b1b2adb --- /dev/null +++ b/.github/workflows/composites/save-controller-images/action.yaml @@ -0,0 +1,15 @@ +name: save controller docker images +description: save controller docker images +runs: + using: "composite" + steps: + - name: save controller docker images + shell: bash + run: | + mkdir -p /tmp/docker/images + TAG=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) + cd spring-cloud-kubernetes-controllers + while read controller_image; do + docker save -o /tmp/docker/images/${controller_image}.tar docker.io/springcloud/${controller_image}:$TAG + done < <(mvn -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q | grep -v 'spring-cloud-kubernetes-controllers') + cd .. diff --git a/.github/workflows/composites/save-integration-tests-images/action.yaml b/.github/workflows/composites/save-integration-tests-images/action.yaml new file mode 100644 index 0000000000..72699f9748 --- /dev/null +++ b/.github/workflows/composites/save-integration-tests-images/action.yaml @@ -0,0 +1,15 @@ +name: save integration tests docker images +description: save integration tests docker images +runs: + using: "composite" + steps: + - name: save integration tests docker images + shell: bash + run: | + mkdir -p /tmp/docker/images + TAG=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) + cd spring-cloud-kubernetes-integration-tests + while read integ_test; do + docker save -o /tmp/docker/images/${integ_test}.tar docker.io/springcloud/${integ_test}:$TAG + done < <(mvn -Dexec.executable='echo' -Dexec.args='${project.artifactId}' exec:exec -q | grep -v 'spring-cloud-kubernetes-integration-tests') + cd .. diff --git a/.github/workflows/composites/setup/action.yaml b/.github/workflows/composites/setup/action.yaml new file mode 100644 index 0000000000..09ac987944 --- /dev/null +++ b/.github/workflows/composites/setup/action.yaml @@ -0,0 +1,9 @@ +name: setup project +description: setup project +runs: + using: "composite" + steps: + - uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '17' diff --git a/.github/workflows/composites/upload-docker-images/action.yaml b/.github/workflows/composites/upload-docker-images/action.yaml new file mode 100644 index 0000000000..b0506b82ad --- /dev/null +++ b/.github/workflows/composites/upload-docker-images/action.yaml @@ -0,0 +1,15 @@ +# we are not going to use upload/download actions, since it is slower than cache usage +# as key to the cache we are going to use DOCKER_IMAGES_KEY, which is the same as GITHUB_RUN_ID + +name: upload docker images +description: upload docker images +runs: + using: "composite" + steps: + - uses: actions/cache@v2 + with: + path: /tmp/docker/images + key: docker-images-cache-${{ env.DOCKER_IMAGES_KEY }} + restore-keys: docker-images-cache-${{ env.DOCKER_IMAGES_KEY }} + + diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index 2115a906c6..0f2d986503 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -7,88 +7,80 @@ on: branches: [ main ] jobs: - # build the project, skip tests, update snapshots - ########################################################################################################################### - ######################################## Build test support dependency and Run test ####################################### build: runs-on: ubuntu-latest - + env: + TESTCONTAINERS_REUSE_ENABLE: false steps: - - uses: actions/checkout@v2 - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: '17' - - - name: Extract branch name - id: extract_branch - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF})" - - # if this is the first build, this is a NOOP and every dependency is downloaded. - # if this is != first build, cache is restored. We then issue mvn clean install with "-U", - # and thus update any third party snapshots; also we build the project, thus update - # any inter-module snapshot dependencies. - # only after that is the cache saved, which is what we want. Any subsequent restores as such - # will have the latest versions of snapshots available. - - name: Cache local Maven repository - id: cache-maven-repo - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }} - - if: ${{ steps.cache-maven-repo.outputs.cache-hit == 'false' }} - name: cache miss callback - continue-on-error: false - run: echo 'cache miss' + - name: checkout project + uses: actions/checkout@v2 + + - name: setup project + uses: ./.github/workflows/composites/setup + + - name: set env variables + uses: ./.github/workflows/composites/env-variables + + - name: cache local maven repository + uses: ./.github/workflows/composites/cache + + - name: build fabric8 istio + uses: ./.github/workflows/composites/fabric8-istio - - if: ${{ steps.cache-maven-repo.outputs.cache-hit == 'true' }} - name: cache hit callback - continue-on-error: false - run: echo 'cache hit' + - name: build with skip tests and skip images + run: ./mvnw -T 1C -s .settings.xml clean install -U -DskipTests -Dskip.build.image=true - - name: Build with skip tests - run: ./mvnw -s .settings.xml clean install -U -DskipTests + - name: build controllers project + uses: ./.github/workflows/composites/build-controllers-project + + - name: build integration tests project + uses: ./.github/workflows/composites/build-integration-tests-project + + - name: save controller docker images + uses: ./.github/workflows/composites/save-controller-images + + - name: save integration tests docker images + uses: ./.github/workflows/composites/save-integration-tests-images + + - name: echo saved images + uses: ./.github/workflows/composites/echo-saved-images + + - name: upload docker images + uses: ./.github/workflows/composites/upload-docker-images # we need to run some test, so that K3s container is started and then all other instances will re-use this one. # Otherwise, (since we use static ports) there might be two instances starting at the same time, and ports might conflict - ########################################################################################################################### - ###################################################### Fabric8 istio test ################################################# - fabric8_istio_test: + fabric8_istio_integration_test: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: '17' + - name: checkout project + uses: actions/checkout@v2 - - name: Cache local Maven repository - id: cache-maven-repo - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }} + - name: setup project + uses: ./.github/workflows/composites/setup - - name: test fabric8 istio - run: | - cd spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/ - ../.././mvnw clean install - cd ../.. + - name: set env variables + uses: ./.github/workflows/composites/env-variables + + - name: cache local maven repository + uses: ./.github/workflows/composites/cache + + - name: download docker images + uses: ./.github/workflows/composites/download-docker-images + + - name: echo saved images + uses: ./.github/workflows/composites/echo-saved-images + - name: integration test fabric8 istio + uses: ./.github/workflows/composites/fabric8-istio-integration-test test: - needs: build + needs: [ build, fabric8_istio_integration_test ] runs-on: ubuntu-latest + timeout-minutes: 60 strategy: fail-fast: true @@ -97,102 +89,155 @@ jobs: number_of_jobs: [32] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v2 - name: Set up JDK - with: - distribution: 'temurin' - java-version: '17' - - name: Cache local Maven repository - id: cache-maven-repo - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }} + - name: testcontainers reuse support + run: echo "testcontainers.reuse.enable=true" > ~/.testcontainers.properties + + - name: checkout project + uses: actions/checkout@v2 + + - name: setup project + uses: ./.github/workflows/composites/setup + + - name: set env variables + uses: ./.github/workflows/composites/env-variables + + - name: cache local maven repository + uses: ./.github/workflows/composites/cache + + - name: download docker images + uses: ./.github/workflows/composites/download-docker-images + + - name: load docker images into local repo + uses: ./.github/workflows/composites/load-docker-images - name: run tests env: CURRENT_INDEX: ${{ matrix.current_index }} NUMBER_OF_JOBS: ${{ matrix.number_of_jobs }} run: | - # find all tests - # exclude Fabric8IstionIT - # only take classes that have @Test inside them - # drop the "begining" xxx/src/test/java - # replace / with . - # drop last ".java" - # replace newline with space - # sort - - CLASSNAMES=($(find . -name '*.java' \ - | grep 'src/test/java' \ - | grep -v 'Fabric8IstioIT' \ - | xargs grep -l '@Test' \ - | sed 's/.*src.test.java.//g' \ - | sed 's@/@.@g' \ - | sed 's/.\{5\}$//' \ - | sort \ - | tr '\n' ' ')) - - number_of_tests=${#CLASSNAMES[@]} - number_of_jobs=${NUMBER_OF_JOBS} - current_index=${CURRENT_INDEX} - - per_instance=$((number_of_tests / number_of_jobs)) - - # we do not get an ideal distribution all the time, so this is needed to add one more test - # to the first "reminder" number of instances. - - # consider the case when there are 10 tests, and 4 instances - # 10/4=2 (and this is "per_instance"), at the same time "reminder" = (10 - 4 * 2) = 2 - # this means that the first instance will run (2 + 1) tests - # second instance will run (2 + 1) tests - # all subsequent instances will run 2 tests. - - reminder=$((number_of_tests - number_of_jobs * per_instance)) - elements_in_current_instance=$((per_instance + 1)) - - left_bound=0 - right_bound=0 - - # we are in a range where we might need to add one more test to each instance - # notice the "less then" condition here, it is important and must not change - if [[ $current_index -lt $reminder ]]; then - - # this one is easy, the range will be [0..3] (following our example above) - if [[ $current_index == 0 ]]; then - left_bound=0 - right_bound=$elements_in_current_instance - # this one will be [3..6] - else - left_bound=$((current_index * elements_in_current_instance)) - right_bound=$(((current_index + 1) * elements_in_current_instance)) - fi - - echo "total tests : $number_of_tests, jobs: $number_of_jobs, current index : $current_index. will run tests in range : [$left_bound..$right_bound]" - - else - - # reminder can be zero here (in case of a perfect distribution): in such a case, this is just "current_index * per_instance". - # if reminder is not zero, we have two regions here, logically. the one of the left is "reminder * elements_in_current_instance", - # basically [0..3] and [3..6] - # and the region on the right [6..8]. - left_bound=$((reminder * elements_in_current_instance + ((current_index - reminder) * per_instance))) - right_bound=$((left_bound + per_instance)) - - echo "total tests : $number_of_tests, jobs: $number_of_jobs, current index : $current_index. will run tests in range : [$left_bound..$right_bound]" - fi - - diff=$((right_bound - left_bound)) - sliced_array=("${CLASSNAMES[@]:$left_bound:$diff}") - TEST_ARG=$(echo $sliced_array | sed 's/ /,/g') - - ./mvnw -s .settings.xml -DfailIfNoTests=false -DtestsToRun=$TEST_ARG -e clean org.jacoco:jacoco-maven-plugin:prepare-agent install \ - -U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true \ - -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + + # - find all tests + # - exclude Fabric8IstionIT + # - only take classes that have @Test inside them + # - ignore the ones that have 'abstract class'. we do this because otherwise we would pass + # to -DtestsToRun an abstract class, and it will not run anything. + # - drop the "begining" xxx/src/test/java + # - replace / with . + # - drop last ".java" + # - replace newline with space + # - replace '\n' with ' ' + + PLAIN_TEST_CLASSNAMES=($(find . -name '*.java' \ + | grep 'src/test/java' \ + | grep -v 'Fabric8IstioIT' \ + | xargs grep -l '@Test' \ + | xargs grep -L 'abstract class' \ + | sed 's/.*src.test.java.//g' \ + | sed 's@/@.@g' \ + | sed 's/.\{5\}$//' \ + | tr '\n' ' ')) + + # classes that have @Test and are abstract, for example: "LabeledSecretWithPrefixTests" + # - exclude Fabric8IstionIT + # - only take classes that have @Test inside them + # - only take classes that are abstract + # - drop everything up until the last "/" + # - drop ".java" + + ABSTRACT_TEST_CLASSNAMES_COMMAND="find . -name '*.java' \ + | grep 'src/test/java' \ + | grep -v 'Fabric8IstioIT' \ + | xargs grep -l '@Test' \ + | xargs grep -l 'abstract class' \ + | sed 's/.*\///g' \ + | sed 's/.java//g'" + + # find classes that extend abstract test classes + DERIVED_FROM_ABSTRACT_CLASSES_COMMAND="find . -name '*.java' \ + | grep 'src/test/java' \ + | grep -v 'Fabric8IstioIT' \ + | xargs grep -l 'extends replace_me ' \ + | sed 's/.*src.test.java.//g' \ + | sed 's@/@.@g' \ + | sed 's/.\{5\}$//' \ + | tr '\n' ' '" + + while read class_name; do + replaced=$(echo ${DERIVED_FROM_ABSTRACT_CLASSES_COMMAND/replace_me/"$class_name"}) + result=($(eval $replaced)) + PLAIN_TEST_CLASSNAMES+=(${result[@]}) + done < <(eval $ABSTRACT_TEST_CLASSNAMES_COMMAND) + + IFS=$'\n' + SORTED_TEST_CLASSNAMES=( $(sort <<< "${PLAIN_TEST_CLASSNAMES[*]} | uniq -u") ) + unset IFS + + number_of_tests=${#SORTED_TEST_CLASSNAMES[@]} + number_of_jobs=${NUMBER_OF_JOBS} + current_index=${CURRENT_INDEX} + + per_instance=$((number_of_tests / number_of_jobs)) + + # we do not get an ideal distribution all the time, so this is needed to add one more test + # to the first "reminder" number of instances. + + # consider the case when there are 10 tests, and 4 instances + # 10/4=2 (and this is "per_instance"), at the same time "reminder" = (10 - 4 * 2) = 2 + # this means that the first instance will run (2 + 1) tests + # second instance will run (2 + 1) tests + # all subsequent instances will run 2 tests. + + reminder=$((number_of_tests - number_of_jobs * per_instance)) + elements_in_current_instance=$((per_instance + 1)) + + left_bound=0 + right_bound=0 + + # we are in a range where we might need to add one more test to each instance + # notice the "less then" condition here, it is important and must not change + if [[ $current_index -lt $reminder ]]; then + + # this one is easy, the range will be [0..3] (following our example above) + if [[ $current_index == 0 ]]; then + left_bound=0 + right_bound=$elements_in_current_instance + # this one will be [3..6] + else + left_bound=$((current_index * elements_in_current_instance)) + right_bound=$(((current_index + 1) * elements_in_current_instance)) + fi + + echo "total tests : $number_of_tests, jobs: $number_of_jobs, current index : $current_index. will run tests in range : [$left_bound..$right_bound]" + + else + + # reminder can be zero here (in case of a perfect distribution): in such a case, this is just "current_index * per_instance". + # if reminder is not zero, we have two regions here, logically. the one of the left is "reminder * elements_in_current_instance", + # basically [0..3] and [3..6] + # and the region on the right [6..8]. + left_bound=$((reminder * elements_in_current_instance + ((current_index - reminder) * per_instance))) + right_bound=$((left_bound + per_instance)) + + echo "total tests : $number_of_tests, jobs: $number_of_jobs, current index : $current_index. will run tests in range : [$left_bound..$right_bound]" + fi + + diff=$((right_bound - left_bound)) + sliced_array=("${SORTED_TEST_CLASSNAMES[@]:$left_bound:$diff}") + TEST_ARG=$(echo ${sliced_array[@]} | sed 's/ /,/g') + + echo "will run tests : ${TEST_ARG[@]}" + + ./mvnw -s .settings.xml \ + -DtestsToRun=${TEST_ARG[@]} \ + -e clean install \ + -U -P sonar -nsu --batch-mode \ + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ + -Dhttp.keepAlive=false \ + -Dmaven.wagon.http.pool=false \ + -Dmaven.wagon.http.retryHandler.class=standard \ + -Dmaven.wagon.http.retryHandler.count=3 \ + -Dskip.build.image=true - name: Publish Test Report uses: mikepenz/action-junit-report@v2 diff --git a/pom.xml b/pom.xml index ced5fbc136..45ebb8d9bc 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ + 4.0.0 diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapIncludeProfileSpecificSourcesTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapIncludeProfileSpecificSourcesTests.java deleted file mode 100644 index c8a43cb3ec..0000000000 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapIncludeProfileSpecificSourcesTests.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2013-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.kubernetes.client.config; - -import com.github.tomakehurst.wiremock.client.WireMock; -import org.hamcrest.Matchers; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.web.reactive.server.WebTestClient; - -/** - * The stub data for this test is in : IncludeProfileSpecificSourcesConfigurationStub - * - * @author wind57 - */ -abstract class KubernetesClientConfigMapIncludeProfileSpecificSourcesTests { - - @Autowired - private WebTestClient webClient; - - @AfterEach - public void afterEach() { - WireMock.reset(); - } - - @AfterAll - public static void afterAll() { - WireMock.shutdownServer(); - } - - /** - *
-	 *   'spring.cloud.kubernetes.config.includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[0].includeProfileSpecificSources=true'
-	 *   'spring.cloud.kubernetes.config.sources[0].name=config-map-one'
-	 *
-	 *   We do not define config-map 'config-map-one', but we do define 'config-map-one-dev'.
-	 *
-	 * 	 As such: @ConfigurationProperties("one") must be resolved from 'config-map-one-dev'
-	 * 
- */ - @Test - public void testOne() { - this.webClient.get().uri("/profile-specific/one").exchange().expectStatus().isOk().expectBody(String.class) - .value(Matchers.equalTo("one")); - } - - /** - *
-	 *   'spring.cloud.kubernetes.config.includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[1].includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[1].name=config-map-two'
-	 *
-	 *   We define config-map 'config-map-two', but we also define 'config-map-two-dev'.
-	 *   This tests proves that data will be read from 'config-map-two' _only_, even if 'config-map-two-dev'
-	 *   also exists. This happens because of the 'includeProfileSpecificSources=false' property defined at the source level.
-	 *   If this would be incorrect, the value we read from '/profile-specific/two' would have been 'twoDev' and _not_ 'two',
-	 *   simply because 'config-map-two-dev' would override the property value.
-	 *
-	 * 	 As such: @ConfigurationProperties("two") must be resolved from 'config-map-two'
-	 * 
- */ - @Test - public void testTwo() { - this.webClient.get().uri("/profile-specific/two").exchange().expectStatus().isOk().expectBody(String.class) - .value(Matchers.equalTo("two")); - } - - /** - *
-	 *   'spring.cloud.kubernetes.config.includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[2].name=config-map-three'
-	 *
-	 *   We define config-map 'config-map-three', but we also define 'config-map-three-dev'.
-	 *   This tests proves that data will be read from 'config-map-three' _only_, even if 'config-map-three-dev'
-	 *   also exists. This happens because the 'includeProfileSpecificSources'  property is not defined at the source level,
-	 *   but it is defaulted from the root level, where we set it to false.
-	 *   If this would be incorrect, the value we read from '/profile-specific/three' would have been 'threeDev' and _not_ 'three',
-	 *   simply because 'config-map-three-dev' would override the property value.
-	 *
-	 * 	 As such: @ConfigurationProperties("three") must be resolved from 'config-map-three'
-	 * 
- */ - @Test - public void testThree() { - this.webClient.get().uri("/profile-specific/three").exchange().expectStatus().isOk().expectBody(String.class) - .value(Matchers.equalTo("three")); - } - -} diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml index d68cf3bc1c..028067f153 100644 --- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml +++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml @@ -66,6 +66,7 @@ ${env.IMAGE} build-image + ${skip.build.image} diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml index c516dbdfa0..1f4138e677 100644 --- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml +++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml @@ -77,6 +77,7 @@ ${env.IMAGE} build-image + ${skip.build.image} diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml index 2a6df50a8a..a9801deaae 100644 --- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml +++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml @@ -58,6 +58,7 @@ ${env.IMAGE} build-image + ${skip.build.image} diff --git a/spring-cloud-kubernetes-fabric8-config/pom.xml b/spring-cloud-kubernetes-fabric8-config/pom.xml index e9907e8dc9..28cd0b715e 100644 --- a/spring-cloud-kubernetes-fabric8-config/pom.xml +++ b/spring-cloud-kubernetes-fabric8-config/pom.xml @@ -5,7 +5,7 @@ spring-cloud-kubernetes org.springframework.cloud -3.0.0-SNAPSHOT + 3.0.0-SNAPSHOT 4.0.0 diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithIncludeProfileSpecificSourcesTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithIncludeProfileSpecificSourcesTests.java deleted file mode 100644 index dfaa5e37a2..0000000000 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/ConfigMapWithIncludeProfileSpecificSourcesTests.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2013-2021 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.kubernetes.fabric8.config; - -import java.util.HashMap; -import java.util.Map; - -import io.fabric8.kubernetes.api.model.ConfigMapBuilder; -import io.fabric8.kubernetes.client.Config; -import io.fabric8.kubernetes.client.KubernetesClient; -import org.hamcrest.Matchers; -import org.junit.jupiter.api.Test; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.web.reactive.server.WebTestClient; - -/** - * @author wind57 - */ -abstract class ConfigMapWithIncludeProfileSpecificSourcesTests { - - private static KubernetesClient mockClient; - - @Autowired - private WebTestClient webClient; - - public static void setUpBeforeClass(KubernetesClient mockClient) { - ConfigMapWithIncludeProfileSpecificSourcesTests.mockClient = mockClient; - // Configure the kubernetes master url to point to the mock server - System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mockClient.getConfiguration().getMasterUrl()); - System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY, "true"); - System.setProperty(Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false"); - System.setProperty(Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY, "false"); - System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, "test"); - System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true"); - - Map one = new HashMap<>(); - one.put("one.property", "one"); - createConfigmap("config-map-one-dev", one); - - Map two = new HashMap<>(); - two.put("two.property", "two"); - createConfigmap("config-map-two", two); - - Map twoDev = new HashMap<>(); - twoDev.put("two.property", "twoDev"); - createConfigmap("config-map-two-dev", twoDev); - - Map three = new HashMap<>(); - three.put("three.property", "three"); - createConfigmap("config-map-three", three); - - Map threeDev = new HashMap<>(); - threeDev.put("three.property", "threeDev"); - createConfigmap("config-map-three-dev", threeDev); - - } - - private static void createConfigmap(String name, Map data) { - mockClient.configMaps().inNamespace("spring-k8s") - .create(new ConfigMapBuilder().withNewMetadata().withName(name).endMetadata().addToData(data).build()); - } - - /** - *
-	 *   'spring.cloud.kubernetes.config.includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[0].includeProfileSpecificSources=true'
-	 *   'spring.cloud.kubernetes.config.sources[0].name=config-map-one'
-	 *
-	 *   We do not define config-map 'config-map-one', but we do define 'config-map-one-dev'.
-	 *
-	 * 	 As such: @ConfigurationProperties("one") must be resolved from 'config-map-one-dev'
-	 * 
- */ - @Test - public void testOne() { - this.webClient.get().uri("/profile-specific/one").exchange().expectStatus().isOk().expectBody(String.class) - .value(Matchers.equalTo("one")); - } - - /** - *
-	 *   'spring.cloud.kubernetes.config.includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[1].includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[1].name=config-map-two'
-	 *
-	 *   We define config-map 'config-map-two', but we also define 'config-map-two-dev'.
-	 *   This tests proves that data will be read from 'config-map-two' _only_, even if 'config-map-two-dev'
-	 *   also exists. This happens because of the 'includeProfileSpecificSources=false' property defined at the source level.
-	 *   If this would be incorrect, the value we read from '/profile-specific/two' would have been 'twoDev' and _not_ 'two',
-	 *   simply because 'config-map-two-dev' would override the property value.
-	 *
-	 * 	 As such: @ConfigurationProperties("two") must be resolved from 'config-map-two'
-	 * 
- */ - @Test - public void testTwo() { - this.webClient.get().uri("/profile-specific/two").exchange().expectStatus().isOk().expectBody(String.class) - .value(Matchers.equalTo("two")); - } - - /** - *
-	 *   'spring.cloud.kubernetes.config.includeProfileSpecificSources=false'
-	 *   'spring.cloud.kubernetes.config.sources[2].name=config-map-three'
-	 *
-	 *   We define config-map 'config-map-three', but we also define 'config-map-three-dev'.
-	 *   This tests proves that data will be read from 'config-map-three' _only_, even if 'config-map-three-dev'
-	 *   also exists. This happens because the 'includeProfileSpecificSources'  property is not defined at the source level,
-	 *   but it is defaulted from the root level, where we set it to false.
-	 *   If this would be incorrect, the value we read from '/profile-specific/three' would have been 'threeDev' and _not_ 'three',
-	 *   simply because 'config-map-three-dev' would override the property value.
-	 *
-	 * 	 As such: @ConfigurationProperties("three") must be resolved from 'config-map-three'
-	 * 
- */ - @Test - public void testThree() { - this.webClient.get().uri("/profile-specific/three").exchange().expectStatus().isOk().expectBody(String.class) - .value(Matchers.equalTo("three")); - } - -} diff --git a/spring-cloud-kubernetes-integration-tests/README b/spring-cloud-kubernetes-integration-tests/README new file mode 100644 index 0000000000..cf27299b4a --- /dev/null +++ b/spring-cloud-kubernetes-integration-tests/README @@ -0,0 +1,33 @@ +Writing a new integration test should be done with minor things in mind, so that +tests are picked up by our CI/CD pipeline and work as expected. In particular when you +define the plugin that builds the image (integrations tests have a docker image build), +you must name the image with the same name as the module. For example: + + + + org.springframework.boot + spring-boot-maven-plugin + + docker.io/springcloud/${project.artifactId}:${project.version} + paketobuildpacks/builder + ${skip.build.image} + + + + package + + build-image + + + + + +Notice this line: + + docker.io/springcloud/${project.artifactId}:${project.version} + +You must follow the same convention. + +One more important part in this configuration is : "${skip.build.image}". +We use this setting in the build pipeline where in some stages we skip the image build, +only to have it build in some latter ones. diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/pom.xml index 0d2559726e..a92ada4bf2 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/pom.xml @@ -91,6 +91,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-configmap-event-reload/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-configmap-event-reload/pom.xml index 754939bb3f..8c99e8274b 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-configmap-event-reload/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-configmap-event-reload/pom.xml @@ -92,6 +92,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/pom.xml index c779ad35b7..1acfdd0a8d 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/pom.xml @@ -92,6 +92,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-reactive-discoveryclient-it/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-reactive-discoveryclient-it/pom.xml index b7c3fc58f4..fddafb1092 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-reactive-discoveryclient-it/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-reactive-discoveryclient-it/pom.xml @@ -86,6 +86,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-secrets-event-reload/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-secrets-event-reload/pom.xml index b4215801ed..4a1eb8aa5d 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-secrets-event-reload/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-secrets-event-reload/pom.xml @@ -86,6 +86,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/pom.xml index c5e73072f5..e9a1f87ed3 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/pom.xml @@ -120,6 +120,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java index 5e9af02178..a3238d1d23 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java @@ -132,7 +132,7 @@ void testActuatorRefresh() throws Exception { api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null); // Wait a bit before we verify - await().atMost(Duration.ofMillis(3400)) + await().atMost(Duration.ofSeconds(30)) .until(() -> !findAll(postRequestedFor(urlEqualTo("/actuator/refresh"))).isEmpty()); verify(postRequestedFor(urlEqualTo("/actuator/refresh"))); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshKafkaIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshKafkaIT.java index cd648a7bf2..2e0e915867 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshKafkaIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshKafkaIT.java @@ -152,7 +152,7 @@ void testRefresh() throws Exception { WebClient serviceClient = builder.baseUrl("http://localhost:80/it").build(); Boolean[] value = new Boolean[1]; - await().pollInterval(Duration.ofSeconds(3)).atMost(Duration.ofSeconds(90)).until(() -> { + await().pollInterval(Duration.ofSeconds(3)).atMost(Duration.ofSeconds(240)).until(() -> { value[0] = serviceClient.method(HttpMethod.GET).retrieve().bodyToMono(Boolean.class).retryWhen(retrySpec()) .block(); return value[0]; @@ -285,7 +285,7 @@ private WebClient.Builder builder() { } private RetryBackoffSpec retrySpec() { - return Retry.fixedDelay(15, Duration.ofSeconds(1)).filter(Objects::nonNull); + return Retry.fixedDelay(240, Duration.ofSeconds(1)).filter(Objects::nonNull); } } diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/pom.xml index e7ef75a381..e7cbb9394a 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/pom.xml @@ -69,6 +69,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-discoveryclient-it/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-discoveryclient-it/pom.xml index 0354115345..9168403644 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-discoveryclient-it/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-discoveryclient-it/pom.xml @@ -75,6 +75,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-event-reload/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-event-reload/pom.xml index f57b48eeff..c75d2bebf0 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-event-reload/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-event-reload/pom.xml @@ -69,6 +69,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/pom.xml index c0a6e6c82f..7cc8d0b643 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/pom.xml @@ -63,6 +63,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/src/test/java/org/springframework/cloud/kubernetes/fabric8/configmap/polling/reload/ConfigMapPollingReloadIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/src/test/java/org/springframework/cloud/kubernetes/fabric8/configmap/polling/reload/ConfigMapPollingReloadIT.java index 0879ad9c91..d327493561 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/src/test/java/org/springframework/cloud/kubernetes/fabric8/configmap/polling/reload/ConfigMapPollingReloadIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap-polling-reload/src/test/java/org/springframework/cloud/kubernetes/fabric8/configmap/polling/reload/ConfigMapPollingReloadIT.java @@ -185,7 +185,7 @@ private WebClient.Builder builder() { } private RetryBackoffSpec retrySpec() { - return Retry.fixedDelay(15, Duration.ofSeconds(1)).filter(Objects::nonNull); + return Retry.fixedDelay(60, Duration.ofSeconds(1)).filter(Objects::nonNull); } } diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap/pom.xml index d670bf6d4d..2342471a14 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-configmap/pom.xml @@ -61,6 +61,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/pom.xml index 746b531b01..86b6ad5675 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/pom.xml @@ -61,6 +61,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-loadbalancer/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-loadbalancer/pom.xml index 4ab0f5c5fd..596179b780 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-loadbalancer/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-loadbalancer/pom.xml @@ -61,6 +61,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-secrets-event-reload/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-secrets-event-reload/pom.xml index 8b775e7c05..9d6abb49f7 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-secrets-event-reload/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-secrets-event-reload/pom.xml @@ -63,6 +63,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-simple-core/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-simple-core/pom.xml index 132ad6d159..eef53b65db 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-simple-core/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-simple-core/pom.xml @@ -61,6 +61,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image} diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/pom.xml index bef179e45e..7ac39b504e 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/pom.xml +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/pom.xml @@ -61,6 +61,7 @@ docker.io/springcloud/${project.artifactId}:${project.version} paketobuildpacks/builder + ${skip.build.image}