(t *testctx.T, lockBytes []byte, expectedPolicy workspace.LockPolicy)
| 501 | } |
| 502 | |
| 503 | func assertContainerFromLockEntry(t *testctx.T, lockBytes []byte, expectedPolicy workspace.LockPolicy) { |
| 504 | t.Helper() |
| 505 | parsed, err := lockfile.Parse(lockBytes) |
| 506 | require.NoError(t, err) |
| 507 | |
| 508 | var found bool |
| 509 | for _, entry := range parsed.Entries() { |
| 510 | if entry.Namespace != "" || entry.Operation != "container.from" { |
| 511 | continue |
| 512 | } |
| 513 | found = true |
| 514 | require.Len(t, entry.Inputs, 2) |
| 515 | |
| 516 | ref, ok := entry.Inputs[0].(string) |
| 517 | require.True(t, ok) |
| 518 | require.Contains(t, ref, "alpine:latest") |
| 519 | |
| 520 | require.Equal(t, string(expectedPolicy), entry.Policy) |
| 521 | |
| 522 | value, ok := entry.Value.(string) |
| 523 | require.True(t, ok) |
| 524 | require.True(t, strings.HasPrefix(value, "sha256:")) |
| 525 | } |
| 526 | |
| 527 | require.True(t, found, "expected container.from entry in lockfile") |
| 528 | } |
| 529 | |
| 530 | func assertGitLockEntry(t *testctx.T, lockBytes []byte, operation string, expectedInputs []any, expectedPolicy workspace.LockPolicy) { |
| 531 | t.Helper() |
no test coverage detected