Skip to content

Commit

Permalink
Add getDevfileRegistrySpecContainer test cases
Browse files Browse the repository at this point in the history
Signed-off-by: thepetk <[email protected]>
  • Loading branch information
thepetk committed Aug 20, 2024
1 parent 7bda669 commit fcf4df9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pkg/registry/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
}

0 comments on commit fcf4df9

Please sign in to comment.