Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Move away from it test configuration #1241

Merged
merged 11 commits into from
Jan 22, 2024
Merged
5 changes: 4 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests-lease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
94 changes: 37 additions & 57 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,34 @@ 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(
GlobalScope / parallelExecution := false,
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(
Expand Down Expand Up @@ -182,10 +190,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
Expand All @@ -197,22 +201,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",
Expand All @@ -224,7 +224,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")
)
)

Expand All @@ -233,23 +233,17 @@ 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
.in(file("integration-test/kubernetes-api-java"))
.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`,
Expand All @@ -262,11 +256,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`,
Expand All @@ -275,15 +266,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`,
Expand All @@ -297,10 +283,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`,
Expand All @@ -313,10 +298,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`,
Expand All @@ -337,26 +319,24 @@ 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`,
`cluster-bootstrap`
)
.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`,
Expand Down
6 changes: 0 additions & 6 deletions integration-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion integration-test/aws-api-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion integration-test/aws-api-ecs/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion integration-test/dns-api-mesos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dockerhub-id>/integration-test-dns-api:1.0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ spec:
containers:
- name: lease-test
imagePullPolicy: Never
image: lease-kubernetes-int-test:latest
image: akka-lease-kubernetes-integration:latest
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (C) 2017-2023 Lightbend Inc. <https://www.lightbend.com>
*/

package akka.coordination.lease.kubernetes

import akka.Done
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/*
* Copyright (C) 2017-2023 Lightbend Inc. <https://www.lightbend.com>
*/

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading
Loading