Skip to content

Commit

Permalink
another test
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Martin <chris@cmartinit.co.uk>
  • Loading branch information
d80tb7 committed Jul 1, 2024
1 parent 63f9638 commit 0962c1c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions internal/common/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ func TestToProtoMap(t *testing.T) {
assert.Equal(t, actual, expected)
}

func TestFromProtoMap(t *testing.T) {
oneCpu := resource.MustParse("1")
oneGi := resource.MustParse("1Gi")

input := map[string]*resource.Quantity{
"cpu": &oneCpu,
"memory": &oneGi,
}
expected := ComputeResources{
"cpu": resource.MustParse("1"),
"memory": resource.MustParse("1Gi"),
}

actual := FromProtoMap(input)
assert.Equal(t, actual, expected)
}

func makeDefaultNodeResource() v1.ResourceList {
cpuResource := resource.NewQuantity(100, resource.DecimalSI)
memoryResource := resource.NewQuantity(50*1024*1024*1024, resource.DecimalSI)
Expand Down

0 comments on commit 0962c1c

Please sign in to comment.