MCPcopy Create free account
hub / github.com/conforma/cli / TestExtractFallbackReason

Function TestExtractFallbackReason

cmd/validate/vsa_test.go:1639–1721  ·  view source on GitHub ↗

TestExtractFallbackReason tests the extractFallbackReason helper function

(t *testing.T)

Source from the content-addressed store, hash-verified

1637
1638// TestExtractFallbackReason tests the extractFallbackReason helper function
1639func TestExtractFallbackReason(t *testing.T) {
1640 tests := []struct {
1641 name string
1642 result *vsa.ValidationResult
1643 expected string
1644 }{
1645 {
1646 name: "policy mismatch",
1647 result: &vsa.ValidationResult{
1648 Message: "Policy mismatch detected",
1649 },
1650 expected: "policy mismatch",
1651 },
1652 {
1653 name: "predicate failed lowercase",
1654 result: &vsa.ValidationResult{
1655 Message: "predicate validation failed",
1656 },
1657 expected: "predicate failed",
1658 },
1659 {
1660 name: "predicate failed uppercase",
1661 result: &vsa.ValidationResult{
1662 Message: "Predicate validation failed",
1663 },
1664 expected: "predicate failed",
1665 },
1666 {
1667 name: "no VSA found",
1668 result: &vsa.ValidationResult{
1669 Message: "No VSA found for image",
1670 },
1671 expected: "no vsa",
1672 },
1673 {
1674 name: "no vsa found lowercase with capital VSA",
1675 result: &vsa.ValidationResult{
1676 Message: "no VSA found for image",
1677 },
1678 expected: "no vsa",
1679 },
1680 {
1681 name: "expired",
1682 result: &vsa.ValidationResult{
1683 Message: "VSA expired on 2023-01-01",
1684 },
1685 expected: "expired",
1686 },
1687 {
1688 name: "retrieval failed",
1689 result: &vsa.ValidationResult{
1690 Message: "failed to check existing VSA",
1691 },
1692 expected: "retrieval failed",
1693 },
1694 {
1695 name: "retrieval failed alternate message",
1696 result: &vsa.ValidationResult{

Callers

nothing calls this directly

Calls 2

extractFallbackReasonFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected