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

Function TestRunValidateVSA

cmd/validate/vsa_test.go:880–966  ·  view source on GitHub ↗

TestRunValidateVSA tests the main execution function

(t *testing.T)

Source from the content-addressed store, hash-verified

878
879// TestRunValidateVSA tests the main execution function
880func TestRunValidateVSA(t *testing.T) {
881 tests := []struct {
882 name string
883 data *validateVSAData
884 args []string
885 expectError bool
886 errorMsg string
887 }{
888 {
889 name: "valid single VSA validation",
890 data: &validateVSAData{
891 vsaIdentifier: "sha256:abc123",
892 images: "",
893 policyConfig: "test-policy.yaml",
894 vsaExpirationStr: "24h",
895 ignoreSignatureVerification: true,
896 },
897 args: []string{},
898 expectError: false,
899 },
900 {
901 name: "valid snapshot validation",
902 data: &validateVSAData{
903 vsaIdentifier: "",
904 images: "snapshot.json",
905 policyConfig: "test-policy.yaml",
906 vsaExpirationStr: "24h",
907 ignoreSignatureVerification: true,
908 },
909 args: []string{},
910 expectError: false,
911 },
912 {
913 name: "error with invalid expiration",
914 data: &validateVSAData{
915 vsaIdentifier: "sha256:abc123",
916 images: "",
917 policyConfig: "test-policy.yaml",
918 vsaExpirationStr: "invalid",
919 ignoreSignatureVerification: true,
920 },
921 args: []string{},
922 expectError: true,
923 errorMsg: "invalid VSA expiration",
924 },
925 {
926 name: "error with missing policy config",
927 data: &validateVSAData{
928 vsaIdentifier: "sha256:abc123",
929 images: "",
930 policyConfig: "",
931 vsaExpirationStr: "24h",
932 ignoreSignatureVerification: true,
933 },
934 args: []string{},
935 expectError: true,
936 errorMsg: "certificate OIDC issuer must be provided for keyless workflow",
937 },

Callers

nothing calls this directly

Calls 3

runValidateVSAFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected