Skip to content

Commit

Permalink
few minor improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Kanha gupta <[email protected]>
  • Loading branch information
kanha-gupta committed May 13, 2024
1 parent 7651313 commit 548a115
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/antctl/raw/check/cluster/test_checkcniexistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (t *checkCNIExistence) Run(ctx context.Context, testContext *testContext) e
command := []string{"ls", "-1", "/etc/cni/net.d"}
output, _, err := check.ExecInPod(ctx, testContext.client, testContext.config, testContext.namespace, testContext.testPod.Name, "", command)
if err != nil {
return fmt.Errorf("failed to execute command in Pod %s, error: %v", testContext.testPod.Name, err)
return fmt.Errorf("failed to execute command in Pod %s, error: %w", testContext.testPod.Name, err)
}
files := strings.Fields(output)
if len(files) == 0 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/antctl/raw/check/cluster/test_checkk8sversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func (t *checkK8sVersion) Run(ctx context.Context, testContext *testContext) err
discoveryClient := testContext.client.Discovery()
serverVersion, err := discoveryClient.ServerVersion()
if err != nil {
return fmt.Errorf("error getting server version: %v", err)
return fmt.Errorf("error getting server version: %w", err)
}
currentVersion, err := semver.Parse(strings.TrimPrefix(serverVersion.GitVersion, "v"))
if err != nil {
return fmt.Errorf("error parsing server version: %v", err)
return fmt.Errorf("error parsing server version: %w", err)
}
minVersion, _ := semver.Parse("1.19")
if currentVersion.GTE(minVersion) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/antctl/raw/check/cluster/test_checkovsloadable.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *checkOVSLoadable) Run(ctx context.Context, testContext *testContext) er
}
stdout, stderr, err := check.ExecInPod(ctx, testContext.client, testContext.config, testContext.namespace, testContext.testPod.Name, "", command)
if err != nil {
return fmt.Errorf("error executing command in Pod %s: %v", testContext.testPod.Name, err)
return fmt.Errorf("error executing command in Pod %s: %w", testContext.testPod.Name, err)
}
if strings.TrimSpace(stdout) == "0" {
testContext.Log("The kernel module openvswitch is built-in")
Expand All @@ -45,14 +45,14 @@ func (c *checkOVSLoadable) Run(ctx context.Context, testContext *testContext) er
cmd := []string{"modprobe", "openvswitch"}
_, stderr, err := check.ExecInPod(ctx, testContext.client, testContext.config, testContext.namespace, testContext.testPod.Name, "", cmd)
if err != nil {
return fmt.Errorf("error executing modprobe command in Pod %s: %v", testContext.testPod.Name, err)
return fmt.Errorf("error executing modprobe command in Pod %s: %w", testContext.testPod.Name, err)
} else if stderr != "" {
return fmt.Errorf("failed to load the OVS kernel module: %s, try running 'modprobe openvswitch' on your Nodes", stderr)
} else {
testContext.Log("openvswitch kernel module loaded successfully")
}
} else {
return fmt.Errorf("error encountered while check if cni is existent - stderr: %s", stderr)
return fmt.Errorf("error encountered while checking if openvswitch module is built-in - stderr: %s", stderr)
}
return nil
}

0 comments on commit 548a115

Please sign in to comment.