Skip to content

Commit c5e780c

Browse files
committed
feat(tests): add tests for custom container resource requirements
1 parent 5b9ed95 commit c5e780c

File tree

2 files changed

+392
-1
lines changed

2 files changed

+392
-1
lines changed

controllers/construct/build_statefulset_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,20 @@ func TestManagedSecurityContext(t *testing.T) {
6767

6868
func TestMongod_Container(t *testing.T) {
6969
const mongodbImageMock = "fake-mongodbImage"
70-
c := container.New(mongodbContainer(mongodbImageMock, []corev1.VolumeMount{}, mdbv1.NewMongodConfiguration()))
70+
71+
// Create a basic MongoDBCommunity instance without custom resources
72+
mdb := &mdbv1.MongoDBCommunity{
73+
ObjectMeta: metav1.ObjectMeta{
74+
Name: "my-rs",
75+
Namespace: "my-ns",
76+
},
77+
Spec: mdbv1.MongoDBCommunitySpec{
78+
Members: 3,
79+
Version: "6.0.5",
80+
},
81+
}
82+
83+
c := container.New(mongodbContainer(mongodbImageMock, []corev1.VolumeMount{}, mdbv1.NewMongodConfiguration(), mdb))
7184

7285
t.Run("Has correct Env vars", func(t *testing.T) {
7386
assert.Len(t, c.Env, 1)

0 commit comments

Comments
 (0)