From fcf4df9d75709af95843d67f3a816274b2c924c5 Mon Sep 17 00:00:00 2001 From: thepetk Date: Tue, 5 Mar 2024 12:38:37 +0000 Subject: [PATCH] Add getDevfileRegistrySpecContainer test cases Signed-off-by: thepetk --- pkg/registry/defaults_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pkg/registry/defaults_test.go b/pkg/registry/defaults_test.go index 80d9ac3..20b73f3 100644 --- a/pkg/registry/defaults_test.go +++ b/pkg/registry/defaults_test.go @@ -399,3 +399,33 @@ func TestIsTelemetryEnabled(t *testing.T) { } } + +func Test_getDevfileRegistrySpecContainer(t *testing.T) { + tests := []struct { + name string + quantity string + defaultValue string + want resource.Quantity + }{ + { + name: "Case 1: DevfileRegistrySpecContainer given correct quantity", + quantity: "256Mi", + defaultValue: "512Mi", + want: resource.MustParse("256Mi"), + }, + { + name: "Case 2: DevfileRegistrySpecContainer given correct quantity", + quantity: "test", + defaultValue: "512Mi", + want: resource.MustParse("512Mi"), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := getDevfileRegistrySpecContainer(tt.quantity, tt.defaultValue) + if result != tt.want { + t.Errorf("func TestgetDevfileRegistrySpecContainer(t *testing.T) {\n error: enablement value mismatch, expected: %v got: %v", tt.want, result) + } + }) + } +}