MCPcopy Create free account
hub / github.com/docker/docker-agent / assertInstalledBinary

Function assertInstalledBinary

pkg/toolinstall/installer_test.go:205–223  ·  view source on GitHub ↗

assertInstalledBinary checks that a binary exists at path with the expected content, is executable, and has a symlink in BinDir().

(t *testing.T, binaryPath, expectedContent, binaryName string)

Source from the content-addressed store, hash-verified

203// assertInstalledBinary checks that a binary exists at path with the expected
204// content, is executable, and has a symlink in BinDir().
205func assertInstalledBinary(t *testing.T, binaryPath, expectedContent, binaryName string) {
206 t.Helper()
207
208 // Verify binary content.
209 data, err := os.ReadFile(binaryPath)
210 require.NoError(t, err)
211 assert.Equal(t, expectedContent, string(data))
212
213 // Verify executable permissions.
214 info, err := os.Stat(binaryPath)
215 require.NoError(t, err)
216 assert.NotZero(t, info.Mode()&0o111, "binary should be executable")
217
218 // Verify symlink in BinDir.
219 link := filepath.Join(BinDir(), binaryName)
220 target, err := os.Readlink(link)
221 require.NoError(t, err)
222 assert.Equal(t, binaryPath, target)
223}
224
225// --- End-to-end Install tests: full download → extract → symlink flow ---
226

Calls 2

BinDirFunction · 0.85
ReadFileMethod · 0.80

Tested by

no test coverage detected