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)
| 203 | // assertInstalledBinary checks that a binary exists at path with the expected |
| 204 | // content, is executable, and has a symlink in BinDir(). |
| 205 | func 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 |
no test coverage detected