Skip to content

Commit

Permalink
tests, style
Browse files Browse the repository at this point in the history
  • Loading branch information
leviramsey committed Jul 25, 2024
1 parent 1837af8 commit 6eb7b8a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
8 changes: 4 additions & 4 deletions rolling-update-kubernetes/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ akka.rollingupdate.kubernetes {
pod-name = ""
pod-name = ${?KUBERNETES_POD_NAME}

# Annotations to check to determine the revision. The first one in the list which matches
# wins. The default is suitable for "vanilla" Kubernetes Deployments, but other CI/CD systems
# may set a different annotation.
revision-annotation = [ "deployment.kubernetes.io/revision" ]
# Annotations to check to determine the revision. The first one in the list which matches
# wins. The default is suitable for "vanilla" Kubernetes Deployments, but other CI/CD systems
# may set a different annotation.
revision-annotation = [ "deployment.kubernetes.io/revision" ]

secure-api-server = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class KubernetesApiSpec
podName = podName,
secure = false,
apiServiceRequestTimeout = 2.seconds,
customResourceSettings = new CustomResourceSettings(enabled = false, crName = None, 60.seconds)
customResourceSettings = new CustomResourceSettings(enabled = false, crName = None, 60.seconds),
revisionAnnotations = Seq("custom.akka.io/revision", "deployment.kubernetes.io/revision")
)
}

Expand Down Expand Up @@ -167,6 +168,17 @@ class KubernetesApiSpec
}
}

"parse pod and replica responses to get the revision from custom annotations" in {
stubPodResponse()
stubReplicaResponse(defaultReplicaResponseJson.replaceAllLiterally("deployment.kubernetes.io", "custom.akka.io"))

EventFilter
.info(pattern = "Reading revision from Kubernetes: akka.cluster.app-version was set to 1", occurrences = 1)
.intercept {
kubernetesApi.readRevision().futureValue should be("1")
}
}

"retry and then fail when pod not found" in {
stubFor(getPod(podName1).willReturn(aResponse().withStatus(404)))
EventFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class PodDeletionCostAnnotatorCrSpec
podName = podName,
secure = false,
apiServiceRequestTimeout = 2.seconds,
customResourceSettings = new CustomResourceSettings(enabled = false, crName = None, 60.seconds)
customResourceSettings = new CustomResourceSettings(enabled = false, crName = None, 60.seconds),
revisionAnnotations = Seq("deployment.kubernetes.io/revision")
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class PodDeletionCostAnnotatorSpec
podName = podName,
secure = false,
apiServiceRequestTimeout = 2.seconds,
customResourceSettings = new CustomResourceSettings(enabled = false, crName = None, 60.seconds)
customResourceSettings = new CustomResourceSettings(enabled = false, crName = None, 60.seconds),
revisionAnnotations = Seq("deployment.kubernetes.io/revision")
)
}

Expand Down

0 comments on commit 6eb7b8a

Please sign in to comment.