Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
Signed-off-by: tombokombo <[email protected]>
  • Loading branch information
tombokombo authored and paleozogt committed May 9, 2023
1 parent 2686cc2 commit e813167
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/aws_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ func TestBuildNodeFromTemplate(t *testing.T) {
// Node with custom resource
ephemeralStorageKey := "ephemeral-storage"
ephemeralStorageValue := int64(20)
customResourceKey := "custom-resource"
customResourceValue := int64(5)
vpcIPKey := "vpc.amazonaws.com/PrivateIPv4Address"
observedNode, observedErr := awsManager.buildNodeFromTemplate(asg, &asgTemplate{
InstanceType: c5Instance,
Expand All @@ -413,12 +415,19 @@ func TestBuildNodeFromTemplate(t *testing.T) {
Key: aws.String(fmt.Sprintf("k8s.io/cluster-autoscaler/node-template/resources/%s", ephemeralStorageKey)),
Value: aws.String(strconv.FormatInt(ephemeralStorageValue, 10)),
},
{
Key: aws.String(fmt.Sprintf("k8s.io/cluster-autoscaler/node-template/resources/%s", customResourceKey)),
Value: aws.String(strconv.FormatInt(customResourceValue, 10)),
},
},
})
assert.NoError(t, observedErr)
esValue, esExist := observedNode.Status.Capacity[apiv1.ResourceName(ephemeralStorageKey)]
assert.True(t, esExist)
assert.Equal(t, int64(20), esValue.Value())
crValue, crExist := observedNode.Status.Capacity[apiv1.ResourceName(customResourceKey)]
assert.True(t, crExist)
assert.Equal(t, int64(5), crValue.Value())
_, ipExist := observedNode.Status.Capacity[apiv1.ResourceName(vpcIPKey)]
assert.False(t, ipExist)

Expand Down

0 comments on commit e813167

Please sign in to comment.