TestRunValidateVSA tests the main execution function
(t *testing.T)
| 878 | |
| 879 | // TestRunValidateVSA tests the main execution function |
| 880 | func 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 | }, |
nothing calls this directly
no test coverage detected