-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for redis standalone
Signed-off-by: Mathieu Cesbron <[email protected]>
- Loading branch information
1 parent
7665d4a
commit 79c4fb7
Showing
7 changed files
with
186 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package controllers | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
redisv1beta2 "github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta2" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
const ( | ||
ns = "default" | ||
redisStandaloneName = "redis-standalone" | ||
|
||
timeout = time.Second * 5 | ||
interval = time.Millisecond * 250 | ||
) | ||
|
||
var _ = Describe("Redis standalone test", func() { | ||
Context("When creating a redis standalone CR", func() { | ||
It("should create a statefulset", func() { | ||
ctx := context.Background() | ||
|
||
var runAsUser int64 = 1000 | ||
var fsGroup int64 = 1000 | ||
redisStandaloneCR := redisv1beta2.Redis{ | ||
TypeMeta: metav1.TypeMeta{ | ||
APIVersion: "redisv1beta2/apiVersion", | ||
Kind: "Redis", | ||
}, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: redisStandaloneName, | ||
Namespace: ns, | ||
}, | ||
Spec: redisv1beta2.RedisSpec{ | ||
PodSecurityContext: &corev1.PodSecurityContext{ | ||
RunAsUser: &runAsUser, | ||
FSGroup: &fsGroup, | ||
}, | ||
// KubernetesConfig: redisv1beta2.KubernetesConfig{}, | ||
}, | ||
} | ||
Expect(k8sClient.Create(ctx, &redisStandaloneCR)).Should(Succeed()) | ||
|
||
Eventually(func() error { | ||
service := &corev1.Service{} | ||
err := k8sClient.Get(ctx, types.NamespacedName{ | ||
Name: redisStandaloneName, | ||
Namespace: ns, | ||
}, service) | ||
return err | ||
}, timeout, interval).Should(BeNil()) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.