Skip to content

Commit 336697a

Browse files
authored
Merge pull request #133 from atlassian-labs/aqasimi/test-coverage
add unit tests for checks
2 parents fb8bc69 + 3716fba commit 336697a

3 files changed

Lines changed: 932 additions & 3 deletions

File tree

pkg/apis/atlassian/v1/cyclenoderequest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (in *CycleNodeRequest) GetNodeGroupNames() []string {
1616
return buildNodeGroupNames(in.Spec.NodeGroupsList, in.Spec.NodeGroupName)
1717
}
1818

19-
// IsPartOfNodeGroup returns whether the CycleNodeRequest is part of the
19+
// IsFromNodeGroup returns whether the CycleNodeRequest is part of the
2020
// provided NodeGroup by comparing the list of named cloud provider nodegroups
2121
// defined in each one. Ordering does not affect equality.
2222
func (in *CycleNodeRequest) IsFromNodeGroup(nodegroup NodeGroup) bool {

pkg/controller/cyclenoderequest/transitioner/checks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func healthCheckPassed(healthCheck v1.HealthCheck, statusCode uint, body []byte)
127127
}
128128

129129
// makeRequest makes the health check request to the endpoint specified, reads the body and returns
130-
// the status code/body to determinate weather it passed
130+
// the status code/body to determinate whether it passed
131131
func (t *CycleNodeRequestTransitioner) makeRequest(httpMethod string, httpClient *http.Client, endpoint string) (uint, []byte, error) {
132132
httpReq, err := http.NewRequest(httpMethod, endpoint, nil)
133133
if err != nil {
@@ -220,7 +220,7 @@ func (t *CycleNodeRequestTransitioner) performInitialHealthChecks(kubeNodes map[
220220
for _, node := range t.cycleNodeRequest.Status.NodesToTerminate {
221221
nodeHash := getNodeHash(node)
222222

223-
// Check if the node is ready, fail the cnr
223+
// Check if the node is not ready, fail the cnr
224224
_, ok := readyNodesSet[nodeHash]
225225
if !ok {
226226
return fmt.Errorf("node %s/%s not ready", nodeHash, node.Name)

0 commit comments

Comments
 (0)