Skip to content

Commit 75879f8

Browse files
committed
Add getDevfileRegistrySpecContainer test cases
Signed-off-by: thepetk <thepetk@gmail.com>
1 parent af35d66 commit 75879f8

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pkg/registry/defaults_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,3 +399,33 @@ func TestIsTelemetryEnabled(t *testing.T) {
399399
}
400400

401401
}
402+
403+
func Test_getDevfileRegistrySpecContainer(t *testing.T) {
404+
tests := []struct {
405+
name string
406+
quantity string
407+
defaultValue string
408+
want resource.Quantity
409+
}{
410+
{
411+
name: "Case 1: DevfileRegistrySpecContainer given correct quantity",
412+
quantity: "256Mi",
413+
defaultValue: "512Mi",
414+
want: resource.MustParse("256Mi"),
415+
},
416+
{
417+
name: "Case 2: DevfileRegistrySpecContainer given correct quantity",
418+
quantity: "test",
419+
defaultValue: "512Mi",
420+
want: resource.MustParse("512Mi"),
421+
},
422+
}
423+
for _, tt := range tests {
424+
t.Run(tt.name, func(t *testing.T) {
425+
result := getDevfileRegistrySpecContainer(tt.quantity, tt.defaultValue)
426+
if result != tt.want {
427+
t.Errorf("func TestgetDevfileRegistrySpecContainer(t *testing.T) {\n error: enablement value mismatch, expected: %v got: %v", tt.want, result)
428+
}
429+
})
430+
}
431+
}

0 commit comments

Comments
 (0)