-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mathieu Cesbron <[email protected]>
- Loading branch information
1 parent
e57531a
commit 966a65e
Showing
7 changed files
with
149 additions
and
50 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,57 @@ | ||
package controllers | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/OT-CONTAINER-KIT/redis-operator/api/v1beta1" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
appsv1 "k8s.io/api/apps/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
const ( | ||
namespaceTest = "namespace-test" | ||
redisStandaloneName = "redis-standalone-test" | ||
|
||
timeout = time.Second * 10 | ||
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() | ||
|
||
// create a namespace in the cluster | ||
ns := corev1.Namespace{ | ||
ObjectMeta: v1.ObjectMeta{ | ||
Name: namespaceTest, | ||
}, | ||
} | ||
Expect(k8sClient.Create(ctx, &ns)).Should(Succeed()) | ||
|
||
redisStandaloneCR := v1beta1.Redis{ | ||
TypeMeta: v1.TypeMeta{ | ||
APIVersion: "redisv1beta1/apiVersion", | ||
Kind: "Redis", | ||
}, | ||
ObjectMeta: v1.ObjectMeta{ | ||
Name: redisStandaloneName, | ||
Namespace: namespaceTest, | ||
}, | ||
} | ||
Expect(k8sClient.Create(ctx, &redisStandaloneCR)).Should(Succeed()) | ||
|
||
redisStandaloneNamespacedName := types.NamespacedName{Name: redisStandaloneName, Namespace: namespaceTest} | ||
createdSts := &appsv1.Deployment{} | ||
Eventually(func() bool { | ||
err := k8sClient.Get(ctx, redisStandaloneNamespacedName, createdSts) | ||
return err != nil | ||
}, timeout, interval).Should(BeTrue()) | ||
}) | ||
}) | ||
}) |
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
Oops, something went wrong.