Skip to content

Commit

Permalink
fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Disper committed Mar 5, 2024
1 parent 0e2f13b commit 7d902ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 2 additions & 5 deletions internal/controller/gardener_cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
var _ = Describe("Gardener Cluster controller", func() {
Context("Secret with kubeconfig doesn't exist", func() {
It("Should create secret, and set Ready status on CR", func() {
Skip("Skipping for now, do not merge with this!")
kymaName := "kymaname1"
secretName := "secret-name1"
shootName := "shootName1"
Expand Down Expand Up @@ -57,7 +56,6 @@ var _ = Describe("Gardener Cluster controller", func() {
})

It("Should delete secret", func() {
Skip("Skipping for now, do not merge with this!")
kymaName := "kymaname2"
secretName := "secret-name2"
shootName := "shootName2"
Expand Down Expand Up @@ -87,7 +85,6 @@ var _ = Describe("Gardener Cluster controller", func() {
})

It("Should set Error status on CR if failed to fetch kubeconfig", func() {
Skip("Skipping for now, do not merge with this!")
kymaName := "kymaname3"
secretName := "secret-name3"
shootName := "shootName3"
Expand All @@ -112,7 +109,6 @@ var _ = Describe("Gardener Cluster controller", func() {
Context("Secret with kubeconfig exists", func() {
namespace := "default"
DescribeTable("Should update secret", func(gardenerClusterCR imv1.GardenerCluster, secret corev1.Secret, expectedKubeconfig string) {
Skip("Skipping for now, do not merge with this!")
By("Create kubeconfig secret")
Expect(k8sClient.Create(context.Background(), &secret)).To(Succeed())

Expand Down Expand Up @@ -249,7 +245,8 @@ func fixSecretLabels(kymaName, shootName string) map[string]string {

func fixGardenerClusterCR(kymaName, namespace, shootName, secretName string) imv1.GardenerCluster {
return newTestGardenerClusterCR(kymaName, namespace, shootName, secretName).
WithLabels(fixGardenerClusterLabels(kymaName, shootName)).ToCluster()
WithLabels(fixGardenerClusterLabels(kymaName, shootName)).
ToCluster()
}

func fixGardenerClusterCRWithForceRotationAnnotation(kymaName, namespace, shootName, secretName string) imv1.GardenerCluster {
Expand Down
10 changes: 6 additions & 4 deletions internal/controller/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ func (m Metrics) SetGardenerClusterStates(cluster v1.GardenerCluster) {
var runtimeId = cluster.GetLabels()[runtimeIDLabel]

Check warning on line 36 in internal/controller/metrics/metrics.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var-naming: var runtimeId should be runtimeID (revive)

if runtimeId != "" {
var reason = cluster.Status.Conditions[0].Reason
if len(cluster.Status.Conditions) != 0 {
var reason = cluster.Status.Conditions[0].Reason

// first clean the old metric
m.cleanUpGardenerClusterGauge(runtimeId)
m.gardenerClustersStateGaugeVec.WithLabelValues(runtimeId, string(cluster.Status.State), reason).Set(1)
// first clean the old metric
m.cleanUpGardenerClusterGauge(runtimeId)
m.gardenerClustersStateGaugeVec.WithLabelValues(runtimeId, string(cluster.Status.State), reason).Set(1)
}
}
}

Expand Down

0 comments on commit 7d902ad

Please sign in to comment.