diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index a93fac7bc..30ca8f511 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -37,7 +37,10 @@ jobs: jvm: temurin:1.11.0 - name: Code style check, compilation and binary-compatibility check - run: sbt "scalafmtCheckAll;headerCheckAll;+Test/compile;+IntegrationTest/compile;mimaReportBinaryIssues" + run: sbt "scalafmtCheckAll;headerCheckAll;+Test/compile;mimaReportBinaryIssues" + + - name: Code style check, compilation for integration tests + run: sbt "akka-management-integration/scalafmtCheckAll;akka-management-integration/headerCheckAll;+akka-management-integration/Test/compile" check-docs: name: Check Docs diff --git a/.github/workflows/integration-tests-app-version-revision.yml b/.github/workflows/integration-tests-app-version-revision.yml index de692fcf7..25e21e145 100644 --- a/.github/workflows/integration-tests-app-version-revision.yml +++ b/.github/workflows/integration-tests-app-version-revision.yml @@ -52,7 +52,7 @@ jobs: - name: Run Integration Tests run: |- - ./integration-test/rollingupdate-kubernetes/test-app-version-revision.sh + ./integration-test/rolling-update-kubernetes/test-app-version-revision.sh - name: Print logs on failure if: ${{ failure() }} diff --git a/.github/workflows/integration-tests-lease.yml b/.github/workflows/integration-tests-lease.yml index 414fc47ee..3338a9f89 100644 --- a/.github/workflows/integration-tests-lease.yml +++ b/.github/workflows/integration-tests-lease.yml @@ -62,8 +62,8 @@ jobs: echo 'Adding proxy port' kubectl proxy --port=8080 & echo 'Running tests' - sbt ";lease-kubernetes/it:test" - ./lease-kubernetes-int-test/minikube-test.sh + sbt ";lease-kubernetes-integration/test" + ./integration-test/lease-kubernetes/minikube-test.sh - name: Print logs on failure if: ${{ failure() }} diff --git a/.github/workflows/integration-tests-rollingupdate-cr.yml b/.github/workflows/integration-tests-rolling-update-cr.yml similarity index 93% rename from .github/workflows/integration-tests-rollingupdate-cr.yml rename to .github/workflows/integration-tests-rolling-update-cr.yml index d6e3d9cf8..b4ecfadd0 100644 --- a/.github/workflows/integration-tests-rollingupdate-cr.yml +++ b/.github/workflows/integration-tests-rolling-update-cr.yml @@ -60,8 +60,8 @@ jobs: echo 'Adding proxy port' kubectl proxy --port=8080 & echo 'Running tests' - sbt "rolling-update-kubernetes/IntegrationTest/test" - ./integration-test/rollingupdate-kubernetes/test-cr.sh + sbt "integration-test-rolling-update-kubernetes/test" + ./integration-test/rolling-update-kubernetes/test-cr.sh - name: Print logs on failure if: ${{ failure() }} diff --git a/.github/workflows/integration-tests-rollingupdate.yml b/.github/workflows/integration-tests-rolling-update.yml similarity index 95% rename from .github/workflows/integration-tests-rollingupdate.yml rename to .github/workflows/integration-tests-rolling-update.yml index 3e8c46c33..f86239fce 100644 --- a/.github/workflows/integration-tests-rollingupdate.yml +++ b/.github/workflows/integration-tests-rolling-update.yml @@ -52,7 +52,7 @@ jobs: - name: Run Integration Tests run: |- - ./integration-test/rollingupdate-kubernetes/test.sh + ./integration-test/rolling-update-kubernetes/test.sh - name: Print logs on failure if: ${{ failure() }} diff --git a/build.sbt b/build.sbt index 0066e56d0..acf4fd6c0 100644 --- a/build.sbt +++ b/build.sbt @@ -25,19 +25,10 @@ lazy val `akka-management-root` = project `akka-management-pki`, `loglevels-logback`, `loglevels-log4j2`, - `integration-test-aws-api-ec2-tag-based`, - `integration-test-local`, - `integration-test-aws-api-ecs`, - `integration-test-kubernetes-api`, - `integration-test-kubernetes-api-java`, - `integration-test-kubernetes-dns`, - `integration-test-marathon-api-docker`, - `integration-test-rollingupdate-kubernetes`, `cluster-http`, `cluster-bootstrap`, `rolling-update-kubernetes`, `lease-kubernetes`, - `lease-kubernetes-int-test`, docs ) .settings( @@ -45,6 +36,23 @@ lazy val `akka-management-root` = project publish / skip := true ) +// integration tests separated so they don't run on `test` in root project +// also, none of these are published artifacts +lazy val `akka-management-integration` = project + .in(file("integration-test")) + .disablePlugins(MimaPlugin, com.geirsson.CiReleasePlugin) + .aggregate( + `integration-test-aws-api-ec2-tag-based`, + `integration-test-local`, + `integration-test-aws-api-ecs`, + `integration-test-kubernetes-api`, + `integration-test-kubernetes-api-java`, + `integration-test-kubernetes-dns`, + `integration-test-marathon-api-docker`, + `integration-test-rolling-update-kubernetes`, + `lease-kubernetes-integration` + ) + lazy val mimaPreviousArtifactsSet = mimaPreviousArtifacts := Set( organization.value %% name.value % previousStableVersion.value.getOrElse( @@ -170,10 +178,6 @@ lazy val `rolling-update-kubernetes` = project libraryDependencies := Dependencies.RollingUpdateKubernetes, mimaPreviousArtifacts := Set.empty ) - .settings( - Defaults.itSettings - ) - .configs(IntegrationTest) .dependsOn(`akka-management-pki`) lazy val `lease-kubernetes` = project @@ -185,22 +189,18 @@ lazy val `lease-kubernetes` = project libraryDependencies := Dependencies.LeaseKubernetes, mimaPreviousArtifactsSet ) - .settings( - Defaults.itSettings - ) - .configs(IntegrationTest) .dependsOn(`akka-management-pki`) -lazy val `lease-kubernetes-int-test` = project - .in(file("lease-kubernetes-int-test")) +lazy val `lease-kubernetes-integration` = project + .in(file("integration-test/lease-kubernetes")) .enablePlugins(JavaAppPackaging, DockerPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) .dependsOn(`lease-kubernetes`) .enablePlugins(AutomateHeaderPlugin) .disablePlugins(MimaPlugin) + .settings(IntegrationTests.settings) .settings( - name := "akka-lease-kubernetes-int-test", - publish / skip := true, + name := "akka-lease-kubernetes-integration", libraryDependencies := Dependencies.LeaseKubernetesTest, version ~= (_.replace('+', '-')), dockerBaseImage := "docker.io/library/eclipse-temurin:17.0.8.1_1-jre", @@ -212,7 +212,7 @@ lazy val `lease-kubernetes-int-test` = project dockerCommands ++= Seq( Cmd("USER", "root"), Cmd("RUN", "chgrp -R 0 . && chmod -R g=u ."), - Cmd("RUN", "chmod +x /opt/docker/bin/akka-lease-kubernetes-int-test") + Cmd("RUN", "chmod +x /opt/docker/bin/akka-lease-kubernetes-integration") ) ) @@ -221,11 +221,8 @@ lazy val `integration-test-kubernetes-api` = project .enablePlugins(AutomateHeaderPlugin) .disablePlugins(MimaPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) - .settings( - publish / skip := true, - doc / sources := Seq.empty, - libraryDependencies := Dependencies.BootstrapDemos - ) + .settings(IntegrationTests.settings) + .settings(libraryDependencies := Dependencies.BootstrapDemos) .dependsOn(`akka-management`, `cluster-http`, `cluster-bootstrap`, `akka-discovery-kubernetes-api`) lazy val `integration-test-kubernetes-api-java` = project @@ -233,11 +230,8 @@ lazy val `integration-test-kubernetes-api-java` = project .enablePlugins(AutomateHeaderPlugin) .disablePlugins(MimaPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) - .settings( - publish / skip := true, - doc / sources := Seq.empty, - libraryDependencies := Dependencies.BootstrapDemos - ) + .settings(IntegrationTests.settings) + .settings(libraryDependencies := Dependencies.BootstrapDemos) .dependsOn( `akka-management`, `cluster-http`, @@ -250,11 +244,8 @@ lazy val `integration-test-kubernetes-dns` = project .enablePlugins(AutomateHeaderPlugin) .disablePlugins(MimaPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) - .settings( - publish / skip := true, - doc / sources := Seq.empty, - libraryDependencies := Dependencies.BootstrapDemos - ) + .settings(IntegrationTests.settings) + .settings(libraryDependencies := Dependencies.BootstrapDemos) .dependsOn( `akka-management`, `cluster-http`, @@ -263,15 +254,10 @@ lazy val `integration-test-kubernetes-dns` = project lazy val `integration-test-aws-api-ec2-tag-based` = project .in(file("integration-test/aws-api-ec2")) - .configs(IntegrationTest) .enablePlugins(AutomateHeaderPlugin) .disablePlugins(MimaPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) - .settings( - publish / skip := true, - doc / sources := Seq.empty, - Defaults.itSettings - ) + .settings(IntegrationTests.settings) .dependsOn( `akka-management`, `cluster-http`, @@ -285,10 +271,9 @@ lazy val `integration-test-marathon-api-docker` = project .disablePlugins(MimaPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) .settings( - name := "integration-test-marathon-api-docker", - publish / skip := true, - doc / sources := Seq.empty + name := "integration-test-marathon-api-docker" ) + .settings(IntegrationTests.settings) .dependsOn( `akka-management`, `cluster-http`, @@ -301,10 +286,7 @@ lazy val `integration-test-aws-api-ecs` = project .enablePlugins(AutomateHeaderPlugin) .disablePlugins(MimaPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) - .settings( - publish / skip := true, - doc / sources := Seq.empty - ) + .settings(IntegrationTests.settings) .dependsOn( `akka-management`, `cluster-http`, @@ -325,10 +307,9 @@ lazy val `integration-test-local` = project .disablePlugins(com.geirsson.CiReleasePlugin) .settings( name := "integration-test-local", - publish / skip := true, - doc / sources := Seq.empty, libraryDependencies := Dependencies.BootstrapDemos ) + .settings(IntegrationTests.settings) .dependsOn( `akka-management`, `cluster-http`, @@ -336,15 +317,14 @@ lazy val `integration-test-local` = project ) .enablePlugins(JavaAppPackaging, AshScriptPlugin) -lazy val `integration-test-rollingupdate-kubernetes` = project - .in(file("integration-test/rollingupdate-kubernetes")) +lazy val `integration-test-rolling-update-kubernetes` = project + .in(file("integration-test/rolling-update-kubernetes")) .enablePlugins(AutomateHeaderPlugin) .disablePlugins(MimaPlugin) .disablePlugins(com.geirsson.CiReleasePlugin) + .settings(IntegrationTests.settings) .settings( - publish / skip := true, - doc / sources := Seq.empty, - libraryDependencies := Dependencies.BootstrapDemos + libraryDependencies := Dependencies.BootstrapDemos ++ Dependencies.RollingUpdateKubernetesIntegration ) .dependsOn( `akka-management`, diff --git a/integration-test/README.md b/integration-test/README.md index 5dcdc91a9..791b11fbe 100644 --- a/integration-test/README.md +++ b/integration-test/README.md @@ -2,9 +2,3 @@ A set of projects that test Akka Bootstrap along with other Akka Management features in various environments. -Currently the following run as part of CI: - -* `kubernetes-api` - uses the Kubernetes API in minikube to test bootstrap -* `kubernetes-api-dns` - uses DNS service discovery in minikube to test bootstrap -* `kubernetes-api-java` - uses the Kubernetes API in minikube to test bootstrap from a Java/Maven project -* `local` uses config service discovery to form a cluster validates health checks diff --git a/integration-test-scripts/aws-api-ec2-tag-based.sh b/integration-test/aws-api-ec2/aws-api-ec2-tag-based.sh similarity index 100% rename from integration-test-scripts/aws-api-ec2-tag-based.sh rename to integration-test/aws-api-ec2/aws-api-ec2-tag-based.sh diff --git a/integration-test/aws-api-ecs/README.md b/integration-test/aws-api-ecs/README.md index 008bed7df..78545e256 100644 --- a/integration-test/aws-api-ecs/README.md +++ b/integration-test/aws-api-ecs/README.md @@ -50,7 +50,7 @@ before executing it, to understand what's happening inside: `./scripts/publish.sh` -The script uses `docker:publishLocal` and then tags and pushes the image +The script uses `Docker/publishLocal` and then tags and pushes the image manually (in favour of just using `docker:publish` as might normally be done) because this avoids the need to set `dockerRepository` within the SBT build (which would then require that we inject the AWS account ID into the build). diff --git a/integration-test/aws-api-ecs/scripts/publish.sh b/integration-test/aws-api-ecs/scripts/publish.sh index b30e009cf..782893abd 100755 --- a/integration-test/aws-api-ecs/scripts/publish.sh +++ b/integration-test/aws-api-ecs/scripts/publish.sh @@ -10,7 +10,7 @@ fi DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -(cd $DIR/../../.. && sbt integration-test-aws-api-ecs/docker:publishLocal) +(cd $DIR/../../.. && sbt integration-test-aws-api-ecs/Docker/publishLocal) eval $( aws ecr get-login \ diff --git a/integration-test/dns-api-mesos/README.md b/integration-test/dns-api-mesos/README.md index a7370d245..a9cec2272 100644 --- a/integration-test/dns-api-mesos/README.md +++ b/integration-test/dns-api-mesos/README.md @@ -2,7 +2,7 @@ DNS lookup example ================== Build and publish docker image into the local repo. -`sbt docker:publishLocal` +`sbt Docker/publishLocal` Tag built image: `docker tag integration-test-dns-api:1.0 /integration-test-dns-api:1.0` diff --git a/lease-kubernetes-int-test/README.md b/integration-test/lease-kubernetes/README.md similarity index 100% rename from lease-kubernetes-int-test/README.md rename to integration-test/lease-kubernetes/README.md diff --git a/lease-kubernetes-int-test/kubernetes/deployment.yml b/integration-test/lease-kubernetes/kubernetes/deployment.yml similarity index 85% rename from lease-kubernetes-int-test/kubernetes/deployment.yml rename to integration-test/lease-kubernetes/kubernetes/deployment.yml index cdb24bda2..88f931659 100644 --- a/lease-kubernetes-int-test/kubernetes/deployment.yml +++ b/integration-test/lease-kubernetes/kubernetes/deployment.yml @@ -17,4 +17,4 @@ spec: containers: - name: lease-test imagePullPolicy: Never - image: lease-kubernetes-int-test:latest + image: akka-lease-kubernetes-integration:latest diff --git a/lease-kubernetes-int-test/kubernetes/job.yml b/integration-test/lease-kubernetes/kubernetes/job.yml similarity index 80% rename from lease-kubernetes-int-test/kubernetes/job.yml rename to integration-test/lease-kubernetes/kubernetes/job.yml index 26dcd5693..9f330a0df 100644 --- a/lease-kubernetes-int-test/kubernetes/job.yml +++ b/integration-test/lease-kubernetes/kubernetes/job.yml @@ -11,5 +11,5 @@ spec: containers: - name: lease-test imagePullPolicy: Never - image: akka-lease-kubernetes-int-test:latest + image: akka-lease-kubernetes-integration:latest restartPolicy: Never diff --git a/lease-kubernetes-int-test/kubernetes/rbac.yml b/integration-test/lease-kubernetes/kubernetes/rbac.yml similarity index 100% rename from lease-kubernetes-int-test/kubernetes/rbac.yml rename to integration-test/lease-kubernetes/kubernetes/rbac.yml diff --git a/lease-kubernetes-int-test/minikube-test.sh b/integration-test/lease-kubernetes/minikube-test.sh similarity index 92% rename from lease-kubernetes-int-test/minikube-test.sh rename to integration-test/lease-kubernetes/minikube-test.sh index 9920639b7..2ec239ca5 100755 --- a/lease-kubernetes-int-test/minikube-test.sh +++ b/integration-test/lease-kubernetes/minikube-test.sh @@ -5,10 +5,10 @@ set -exu JOB_NAME=lease-test -PROJECT_DIR=lease-kubernetes-int-test +PROJECT_DIR=integration-test/lease-kubernetes eval $(minikube -p minikube docker-env) -sbt "lease-kubernetes-int-test / docker:publishLocal" +sbt "lease-kubernetes-integration/Docker/publishLocal" kubectl apply -f $PROJECT_DIR/kubernetes/rbac.yml kubectl delete -f $PROJECT_DIR/kubernetes/job.yml || true diff --git a/lease-kubernetes-int-test/src/main/resources/application.conf b/integration-test/lease-kubernetes/src/main/resources/application.conf similarity index 100% rename from lease-kubernetes-int-test/src/main/resources/application.conf rename to integration-test/lease-kubernetes/src/main/resources/application.conf diff --git a/lease-kubernetes-int-test/src/main/scala/akka/coordination/lease/kubernetes/LeaseSpec.scala b/integration-test/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/LeaseSpec.scala similarity index 100% rename from lease-kubernetes-int-test/src/main/scala/akka/coordination/lease/kubernetes/LeaseSpec.scala rename to integration-test/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/LeaseSpec.scala diff --git a/lease-kubernetes-int-test/src/main/scala/akka/coordination/lease/kubernetes/LeaseTestSuite.scala b/integration-test/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/LeaseTestSuite.scala similarity index 100% rename from lease-kubernetes-int-test/src/main/scala/akka/coordination/lease/kubernetes/LeaseTestSuite.scala rename to integration-test/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/LeaseTestSuite.scala diff --git a/lease-kubernetes-int-test/src/main/scala/akka/coordination/lease/kubernetes/TestFailedReason.scala b/integration-test/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/TestFailedReason.scala similarity index 100% rename from lease-kubernetes-int-test/src/main/scala/akka/coordination/lease/kubernetes/TestFailedReason.scala rename to integration-test/lease-kubernetes/src/main/scala/akka/coordination/lease/kubernetes/TestFailedReason.scala diff --git a/lease-kubernetes/src/it/scala/akka/coordination/lease/kubernetes/KubernetesApiIntegrationTest.scala b/integration-test/lease-kubernetes/src/test/scala/akka/coordination/lease/kubernetes/KubernetesApiIntegrationTest.scala similarity index 98% rename from lease-kubernetes/src/it/scala/akka/coordination/lease/kubernetes/KubernetesApiIntegrationTest.scala rename to integration-test/lease-kubernetes/src/test/scala/akka/coordination/lease/kubernetes/KubernetesApiIntegrationTest.scala index b56adbeaa..c59aa6cb5 100644 --- a/lease-kubernetes/src/it/scala/akka/coordination/lease/kubernetes/KubernetesApiIntegrationTest.scala +++ b/integration-test/lease-kubernetes/src/test/scala/akka/coordination/lease/kubernetes/KubernetesApiIntegrationTest.scala @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2017-2023 Lightbend Inc. + */ + package akka.coordination.lease.kubernetes import akka.Done diff --git a/lease-kubernetes/src/it/scala/akka/coordination/lease/kubernetes/LeaseContentionSpec.scala b/integration-test/lease-kubernetes/src/test/scala/akka/coordination/lease/kubernetes/LeaseContentionSpec.scala similarity index 97% rename from lease-kubernetes/src/it/scala/akka/coordination/lease/kubernetes/LeaseContentionSpec.scala rename to integration-test/lease-kubernetes/src/test/scala/akka/coordination/lease/kubernetes/LeaseContentionSpec.scala index 10a581459..b090cff4b 100644 --- a/lease-kubernetes/src/it/scala/akka/coordination/lease/kubernetes/LeaseContentionSpec.scala +++ b/integration-test/lease-kubernetes/src/test/scala/akka/coordination/lease/kubernetes/LeaseContentionSpec.scala @@ -1,11 +1,13 @@ +/* + * Copyright (C) 2017-2023 Lightbend Inc. + */ + package akka.coordination.lease.kubernetes import java.util.concurrent.Executors - import scala.collection.immutable import scala.concurrent.ExecutionContext import scala.concurrent.Future - import akka.actor.ActorSystem import akka.coordination.lease.TimeoutSettings import akka.coordination.lease.kubernetes.internal.KubernetesApiImpl diff --git a/lease-kubernetes-int-test/src/test/scala/akka/lease/kubernetes/LocalLeaseSpec.scala b/integration-test/lease-kubernetes/src/test/scala/akka/lease/kubernetes/LocalLeaseSpec.scala similarity index 100% rename from lease-kubernetes-int-test/src/test/scala/akka/lease/kubernetes/LocalLeaseSpec.scala rename to integration-test/lease-kubernetes/src/test/scala/akka/lease/kubernetes/LocalLeaseSpec.scala diff --git a/integration-test/rollingupdate-kubernetes/build.sbt b/integration-test/rolling-update-kubernetes/build.sbt similarity index 100% rename from integration-test/rollingupdate-kubernetes/build.sbt rename to integration-test/rolling-update-kubernetes/build.sbt diff --git a/integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-app-value-revision.yml b/integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-app-value-revision.yml similarity index 87% rename from integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-app-value-revision.yml rename to integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-app-value-revision.yml index 53f4bdea3..c52a97480 100644 --- a/integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-app-value-revision.yml +++ b/integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-app-value-revision.yml @@ -2,13 +2,13 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: akka-rollingupdate-demo - name: akka-rollingupdate-demo + app: akka-rolling-update-demo + name: akka-rolling-update-demo spec: replicas: 3 selector: matchLabels: - app: akka-rollingupdate-demo + app: akka-rolling-update-demo strategy: rollingUpdate: maxSurge: 1 @@ -18,12 +18,12 @@ spec: template: metadata: labels: - app: akka-rollingupdate-demo - actorSystemName: akka-rollingupdate-demo + app: akka-rolling-update-demo + actorSystemName: akka-rolling-update-demo spec: containers: - - name: akka-rollingupdate-demo - image: integration-test-rollingupdate-kubernetes:1.3.3.7 + - name: akka-rolling-update-demo + image: integration-test-rolling-update-kubernetes:1.3.3.7 # Remove for a real project, the image is picked up locally for the integration test imagePullPolicy: Never #health diff --git a/integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-cr.yml b/integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-cr.yml similarity index 88% rename from integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-cr.yml rename to integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-cr.yml index 63e0e4222..f39dc8f06 100644 --- a/integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-cr.yml +++ b/integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-cr.yml @@ -3,13 +3,13 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: akka-rollingupdate-demo - name: akka-rollingupdate-demo + app: akka-rolling-update-demo + name: akka-rolling-update-demo spec: replicas: 3 selector: matchLabels: - app: akka-rollingupdate-demo + app: akka-rolling-update-demo strategy: rollingUpdate: maxSurge: 1 @@ -19,12 +19,12 @@ spec: template: metadata: labels: - app: akka-rollingupdate-demo - actorSystemName: akka-rollingupdate-demo + app: akka-rolling-update-demo + actorSystemName: akka-rolling-update-demo spec: containers: - - name: akka-rollingupdate-demo - image: integration-test-rollingupdate-kubernetes:1.3.3.7 + - name: akka-rolling-update-demo + image: integration-test-rolling-update-kubernetes:1.3.3.7 # Remove for a real project, the image is picked up locally for the integration test imagePullPolicy: Never #health @@ -112,7 +112,7 @@ metadata: name: podcost-access subjects: - kind: User - name: system:serviceaccount:akka-rollingupdate-demo-cr-ns:default + name: system:serviceaccount:akka-rolling-update-demo-cr-ns:default roleRef: kind: Role name: podcost-access diff --git a/integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster.yml b/integration-test/rolling-update-kubernetes/kubernetes/akka-cluster.yml similarity index 88% rename from integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster.yml rename to integration-test/rolling-update-kubernetes/kubernetes/akka-cluster.yml index 13194cdba..d11cecbec 100644 --- a/integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster.yml +++ b/integration-test/rolling-update-kubernetes/kubernetes/akka-cluster.yml @@ -3,13 +3,13 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: akka-rollingupdate-demo - name: akka-rollingupdate-demo + app: akka-rolling-update-demo + name: akka-rolling-update-demo spec: replicas: 3 selector: matchLabels: - app: akka-rollingupdate-demo + app: akka-rolling-update-demo strategy: rollingUpdate: maxSurge: 1 @@ -19,12 +19,12 @@ spec: template: metadata: labels: - app: akka-rollingupdate-demo - actorSystemName: akka-rollingupdate-demo + app: akka-rolling-update-demo + actorSystemName: akka-rolling-update-demo spec: containers: - - name: akka-rollingupdate-demo - image: integration-test-rollingupdate-kubernetes:1.3.3.7 + - name: akka-rolling-update-demo + image: integration-test-rolling-update-kubernetes:1.3.3.7 # Remove for a real project, the image is picked up locally for the integration test imagePullPolicy: Never #health @@ -113,7 +113,7 @@ metadata: name: annotate-pods subjects: - kind: User - name: system:serviceaccount:akka-rollingupdate-demo-ns:default + name: system:serviceaccount:akka-rolling-update-demo-ns:default roleRef: kind: Role name: pod-annotator diff --git a/integration-test/rolling-update-kubernetes/project/build.properties b/integration-test/rolling-update-kubernetes/project/build.properties new file mode 100644 index 000000000..e8a1e246e --- /dev/null +++ b/integration-test/rolling-update-kubernetes/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.9.7 diff --git a/integration-test/rollingupdate-kubernetes/src/main/resources/application.conf b/integration-test/rolling-update-kubernetes/src/main/resources/application.conf similarity index 100% rename from integration-test/rollingupdate-kubernetes/src/main/resources/application.conf rename to integration-test/rolling-update-kubernetes/src/main/resources/application.conf diff --git a/integration-test/rollingupdate-kubernetes/src/main/resources/logback.xml b/integration-test/rolling-update-kubernetes/src/main/resources/logback.xml similarity index 90% rename from integration-test/rollingupdate-kubernetes/src/main/resources/logback.xml rename to integration-test/rolling-update-kubernetes/src/main/resources/logback.xml index b04430b17..8d668e418 100644 --- a/integration-test/rollingupdate-kubernetes/src/main/resources/logback.xml +++ b/integration-test/rolling-update-kubernetes/src/main/resources/logback.xml @@ -12,7 +12,7 @@ - + diff --git a/integration-test/rollingupdate-kubernetes/src/main/scala/akka/cluster/bootstrap/PodDeletionCostDemoApp.scala b/integration-test/rolling-update-kubernetes/src/main/scala/akka/cluster/bootstrap/PodDeletionCostDemoApp.scala similarity index 81% rename from integration-test/rollingupdate-kubernetes/src/main/scala/akka/cluster/bootstrap/PodDeletionCostDemoApp.scala rename to integration-test/rolling-update-kubernetes/src/main/scala/akka/cluster/bootstrap/PodDeletionCostDemoApp.scala index 21395ecc5..cf63de30a 100644 --- a/integration-test/rollingupdate-kubernetes/src/main/scala/akka/cluster/bootstrap/PodDeletionCostDemoApp.scala +++ b/integration-test/rolling-update-kubernetes/src/main/scala/akka/cluster/bootstrap/PodDeletionCostDemoApp.scala @@ -10,11 +10,12 @@ import akka.http.scaladsl.Http import akka.http.scaladsl.server.Directives._ import akka.management.cluster.bootstrap.ClusterBootstrap import akka.management.scaladsl.AkkaManagement -import akka.rollingupdate.kubernetes.{ AppVersionRevision, PodDeletionCost } +import akka.rollingupdate.kubernetes.AppVersionRevision +import akka.rollingupdate.kubernetes.PodDeletionCost object PodDeletionCostDemoApp extends App { - implicit val system: ActorSystem = ActorSystem("akka-rollingupdate-demo") + implicit val system: ActorSystem = ActorSystem("akka-rolling-update-demo") import system.log val cluster = Cluster(system) diff --git a/rolling-update-kubernetes/src/it/scala/akka/rollingupdate/kubernetes/KubernetesApiIntegrationTest.scala b/integration-test/rolling-update-kubernetes/src/test/scala/akka/rollingupdate/kubernetes/KubernetesApiIntegrationTest.scala similarity index 98% rename from rolling-update-kubernetes/src/it/scala/akka/rollingupdate/kubernetes/KubernetesApiIntegrationTest.scala rename to integration-test/rolling-update-kubernetes/src/test/scala/akka/rollingupdate/kubernetes/KubernetesApiIntegrationTest.scala index e3b2136a6..dcc0f5a88 100644 --- a/rolling-update-kubernetes/src/it/scala/akka/rollingupdate/kubernetes/KubernetesApiIntegrationTest.scala +++ b/integration-test/rolling-update-kubernetes/src/test/scala/akka/rollingupdate/kubernetes/KubernetesApiIntegrationTest.scala @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2017-2023 Lightbend Inc. + */ + package akka.rollingupdate.kubernetes import scala.concurrent.Await diff --git a/integration-test/rolling-update-kubernetes/test-app-version-revision.sh b/integration-test/rolling-update-kubernetes/test-app-version-revision.sh new file mode 100755 index 000000000..2443c8775 --- /dev/null +++ b/integration-test/rolling-update-kubernetes/test-app-version-revision.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -exu + +export NAMESPACE=akka-rolling-update-demo-ns +export APP_NAME=akka-rolling-update-demo +export PROJECT_NAME=integration-test-rolling-update-kubernetes +export DEPLOYMENT=integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-app-value-revision.yml + +integration-test/scripts/app-version-revision-kubernetes-test.sh + diff --git a/integration-test/rolling-update-kubernetes/test-cr.sh b/integration-test/rolling-update-kubernetes/test-cr.sh new file mode 100755 index 000000000..a6e5e55fb --- /dev/null +++ b/integration-test/rolling-update-kubernetes/test-cr.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -exu + +export NAMESPACE=akka-rolling-update-demo-cr-ns +export APP_NAME=akka-rolling-update-demo +export PROJECT_NAME=integration-test-rolling-update-kubernetes +export CRD=rolling-update-kubernetes/pod-cost.yml +export DEPLOYMENT=integration-test/rolling-update-kubernetes/kubernetes/akka-cluster-cr.yml + +integration-test/scripts/rolling-update-kubernetes-cr-test.sh + diff --git a/integration-test/rolling-update-kubernetes/test.sh b/integration-test/rolling-update-kubernetes/test.sh new file mode 100755 index 000000000..78cee9523 --- /dev/null +++ b/integration-test/rolling-update-kubernetes/test.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -exu + +export NAMESPACE=akka-rolling-update-demo-ns +export APP_NAME=akka-rolling-update-demo +export PROJECT_NAME=integration-test-rolling-update-kubernetes +export DEPLOYMENT=integration-test/rolling-update-kubernetes/kubernetes/akka-cluster.yml + +integration-test/scripts/rolling-update-kubernetes-test.sh + diff --git a/integration-test/rollingupdate-kubernetes/project/build.properties b/integration-test/rollingupdate-kubernetes/project/build.properties deleted file mode 100644 index 8b697bbb9..000000000 --- a/integration-test/rollingupdate-kubernetes/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.1.0 diff --git a/integration-test/rollingupdate-kubernetes/test-app-version-revision.sh b/integration-test/rollingupdate-kubernetes/test-app-version-revision.sh deleted file mode 100755 index ebcbedf08..000000000 --- a/integration-test/rollingupdate-kubernetes/test-app-version-revision.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -exu - -export NAMESPACE=akka-rollingupdate-demo-ns -export APP_NAME=akka-rollingupdate-demo -export PROJECT_NAME=integration-test-rollingupdate-kubernetes -export DEPLOYMENT=integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-app-value-revision.yml - -integration-test/scripts/app-version-revision-kubernetes-test.sh - diff --git a/integration-test/rollingupdate-kubernetes/test-cr.sh b/integration-test/rollingupdate-kubernetes/test-cr.sh deleted file mode 100755 index 1cd8db1e9..000000000 --- a/integration-test/rollingupdate-kubernetes/test-cr.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -exu - -export NAMESPACE=akka-rollingupdate-demo-cr-ns -export APP_NAME=akka-rollingupdate-demo -export PROJECT_NAME=integration-test-rollingupdate-kubernetes -export CRD=rolling-update-kubernetes/pod-cost.yml -export DEPLOYMENT=integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster-cr.yml - -integration-test/scripts/rollingupdate-kubernetes-cr-test.sh - diff --git a/integration-test/rollingupdate-kubernetes/test.sh b/integration-test/rollingupdate-kubernetes/test.sh deleted file mode 100755 index b1900ab51..000000000 --- a/integration-test/rollingupdate-kubernetes/test.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -exu - -export NAMESPACE=akka-rollingupdate-demo-ns -export APP_NAME=akka-rollingupdate-demo -export PROJECT_NAME=integration-test-rollingupdate-kubernetes -export DEPLOYMENT=integration-test/rollingupdate-kubernetes/kubernetes/akka-cluster.yml - -integration-test/scripts/rollingupdate-kubernetes-test.sh - diff --git a/integration-test/scripts/app-version-revision-kubernetes-test.sh b/integration-test/scripts/app-version-revision-kubernetes-test.sh index 5465f04c2..c941bcf4d 100755 --- a/integration-test/scripts/app-version-revision-kubernetes-test.sh +++ b/integration-test/scripts/app-version-revision-kubernetes-test.sh @@ -6,7 +6,7 @@ echo "Running app-version-revision-kubernetes-test.sh with deployment: $DEPLOYME eval $(minikube -p minikube docker-env) -sbt $PROJECT_NAME/docker:publishLocal +sbt $PROJECT_NAME/Docker/publishLocal # function to run after each change of ReplicaSet - see below `kubectl ...` # Param $1 is the expected revision diff --git a/integration-test/scripts/kubernetes-test.sh b/integration-test/scripts/kubernetes-test.sh index 4db7e5300..e7bdd45f8 100755 --- a/integration-test/scripts/kubernetes-test.sh +++ b/integration-test/scripts/kubernetes-test.sh @@ -1,7 +1,7 @@ #!/bin/bash -e eval $(minikube -p minikube docker-env) -sbt $PROJECT_NAME/docker:publishLocal +sbt $PROJECT_NAME/Docker/publishLocal docker images | head diff --git a/integration-test/scripts/rollingupdate-kubernetes-cr-test.sh b/integration-test/scripts/rolling-update-kubernetes-cr-test.sh similarity index 95% rename from integration-test/scripts/rollingupdate-kubernetes-cr-test.sh rename to integration-test/scripts/rolling-update-kubernetes-cr-test.sh index 058534551..22541a004 100755 --- a/integration-test/scripts/rollingupdate-kubernetes-cr-test.sh +++ b/integration-test/scripts/rolling-update-kubernetes-cr-test.sh @@ -1,9 +1,9 @@ #!/bin/bash -e -echo "Running rollingupdate-kubernetes-cr-test.sh with deployment: $DEPLOYMENT" +echo "Running rolling-update-kubernetes-cr-test.sh with deployment: $DEPLOYMENT" eval $(minikube -p minikube docker-env) -sbt $PROJECT_NAME/docker:publishLocal +sbt $PROJECT_NAME/Docker/publishLocal docker images | head diff --git a/integration-test/scripts/rollingupdate-kubernetes-test.sh b/integration-test/scripts/rolling-update-kubernetes-test.sh similarity index 97% rename from integration-test/scripts/rollingupdate-kubernetes-test.sh rename to integration-test/scripts/rolling-update-kubernetes-test.sh index 96d5f02ec..78f39b6f7 100755 --- a/integration-test/scripts/rollingupdate-kubernetes-test.sh +++ b/integration-test/scripts/rolling-update-kubernetes-test.sh @@ -1,9 +1,9 @@ #!/bin/bash -e -echo "Running rollingupdate-kubernetes-test.sh with deployment: $DEPLOYMENT" +echo "Running rolling-update-kubernetes-test.sh with deployment: $DEPLOYMENT" eval $(minikube -p minikube docker-env) -sbt $PROJECT_NAME/docker:publishLocal +sbt $PROJECT_NAME/Docker/publishLocal docker images | head diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 60a84925c..999ab52d1 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -139,12 +139,19 @@ object Dependencies { "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion, "com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion, "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test, - "org.scalatest" %% "scalatest" % ScalaTestVersion % "it,test", + "org.scalatest" %% "scalatest" % ScalaTestVersion % Test, "com.github.tomakehurst" % "wiremock-jre8" % "2.34.0" % Test, - "org.scalatestplus" %% "junit-4-13" % ScalaTestPlusJUnitVersion % "test", - "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % "it,test" + "org.scalatestplus" %% "junit-4-13" % ScalaTestPlusJUnitVersion % Test, + "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test ) + val RollingUpdateKubernetesIntegration = RollingUpdateKubernetes ++ Seq( + "org.scalatest" %% "scalatest" % ScalaTestVersion % Test, + "com.github.tomakehurst" % "wiremock-jre8" % "2.34.0" % Test, + "org.scalatestplus" %% "junit-4-13" % ScalaTestPlusJUnitVersion % Test, + "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test + ) + val LeaseKubernetes = Seq( "com.typesafe.akka" %% "akka-actor" % AkkaVersion, "com.typesafe.akka" %% "akka-coordination" % AkkaVersion, @@ -153,13 +160,14 @@ object Dependencies { "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion, "com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion, "com.github.tomakehurst" % "wiremock-jre8" % "2.35.0" % Test, - "org.scalatest" %% "scalatest" % ScalaTestVersion % "it,test", - "org.scalatestplus" %% "junit-4-13" % ScalaTestPlusJUnitVersion % "it,test", - "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % "it,test" + "org.scalatest" %% "scalatest" % ScalaTestVersion % Test, + "org.scalatestplus" %% "junit-4-13" % ScalaTestPlusJUnitVersion % Test, + "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test ) val LeaseKubernetesTest = Seq( - "org.scalatest" %% "scalatest" % ScalaTestVersion + "org.scalatest" %% "scalatest" % ScalaTestVersion, + "com.typesafe.akka" %% "akka-testkit" % AkkaVersion % Test ) val BootstrapDemos = Seq( diff --git a/project/IntegrationTests.scala b/project/IntegrationTests.scala new file mode 100644 index 000000000..0c3f2151e --- /dev/null +++ b/project/IntegrationTests.scala @@ -0,0 +1,15 @@ +import sbt.Def +import sbt.Keys._ +import sbt._ + +/* + * Copyright (C) 2009-2023 Lightbend Inc. + */ +object IntegrationTests { + + def settings: Seq[Def.Setting[_]] = Seq( + publish / skip := true, + doc / sources := Seq.empty, + Test / fork := true + ) +} diff --git a/rolling-update-kubernetes/src/test/scala/doc/akka/rollingupdate/kubernetes/AppVersionRevisionCompileOnly.scala b/rolling-update-kubernetes/src/test/scala/doc/akka/rollingupdate/kubernetes/AppVersionRevisionCompileOnly.scala index 940f4897b..f8b0a99be 100644 --- a/rolling-update-kubernetes/src/test/scala/doc/akka/rollingupdate/kubernetes/AppVersionRevisionCompileOnly.scala +++ b/rolling-update-kubernetes/src/test/scala/doc/akka/rollingupdate/kubernetes/AppVersionRevisionCompileOnly.scala @@ -5,7 +5,7 @@ package doc.akka.rollingupdate.kubernetes import akka.actor.ActorSystem -import akka.rollingupdate.kubernetes.{ AppVersionRevision } +import akka.rollingupdate.kubernetes.AppVersionRevision object AppVersionRevisionCompileOnly {