Skip to content

Commit

Permalink
cc-env: Remove unused error return value
Browse files Browse the repository at this point in the history
The `getAgentInfo()` can't fail (now), so remove the error return value.

Fixes clearcontainers#791.

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Nov 7, 2017
1 parent 7e31d19 commit 0a98d1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
9 changes: 3 additions & 6 deletions cc-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ func getShimInfo(config oci.RuntimeConfig) (ShimInfo, error) {
return ccShim, nil
}

func getAgentInfo(config oci.RuntimeConfig) (AgentInfo, error) {
func getAgentInfo(config oci.RuntimeConfig) AgentInfo {
ccAgent := AgentInfo{
Type: string(config.AgentType),
Version: unknown,
}

return ccAgent, nil
return ccAgent
}

func getHypervisorInfo(config oci.RuntimeConfig) HypervisorInfo {
Expand Down Expand Up @@ -290,10 +290,7 @@ func getEnvInfo(configFile, logfilePath string, config oci.RuntimeConfig) (env E
return EnvInfo{}, err
}

ccAgent, err := getAgentInfo(config)
if err != nil {
return EnvInfo{}, err
}
ccAgent := getAgentInfo(config)

hypervisor := getHypervisorInfo(config)

Expand Down
22 changes: 1 addition & 21 deletions cc-env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,30 +737,10 @@ func TestCCEnvGetAgentInfo(t *testing.T) {
expectedAgent, err := getExpectedAgentDetails(config)
assert.NoError(t, err)

ccAgent, err := getAgentInfo(config)
assert.NoError(t, err)

ccAgent := getAgentInfo(config)
assert.Equal(t, expectedAgent, ccAgent)
}

func TestCCEnvGetAgentInfoInvalidType(t *testing.T) {
tmpdir, err := ioutil.TempDir("", "")
if err != nil {
panic(err)
}
defer os.RemoveAll(tmpdir)

_, config, err := makeRuntimeConfig(tmpdir)
assert.NoError(t, err)

_, err = getExpectedAgentDetails(config)
assert.NoError(t, err)

config.AgentConfig = "foo"
_, err = getAgentInfo(config)
assert.NoError(t, err)
}

func testCCEnvShowSettings(t *testing.T, tmpdir string, tmpfile *os.File) error {

ccRuntime := RuntimeInfo{}
Expand Down

0 comments on commit 0a98d1c

Please sign in to comment.