MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / TestValidate

Function TestValidate

pkg/blobmanager/s3/provider_test.go:28–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestValidate(t *testing.T) {
29 testCases := []struct {
30 name string
31 creds *Credentials
32 wantErr bool
33 }{
34 {
35 name: "valid credentials",
36 creds: &Credentials{
37 AccessKeyID: "test",
38 SecretAccessKey: "test",
39 Region: "test",
40 Location: "test",
41 },
42 },
43 {
44 name: "valid credentials with deprecated bucket name",
45 creds: &Credentials{
46 AccessKeyID: "test",
47 SecretAccessKey: "test",
48 Region: "test",
49 BucketName: "test",
50 },
51 },
52 {
53 name: "missing access key id",
54 creds: &Credentials{
55 SecretAccessKey: "test",
56 Region: "test",
57 BucketName: "test",
58 },
59 wantErr: true,
60 },
61 {
62 name: "missing secret access key",
63 creds: &Credentials{
64 AccessKeyID: "test",
65 Region: "test",
66 BucketName: "test",
67 },
68 wantErr: true,
69 },
70 {
71 name: "missing bucket name",
72 creds: &Credentials{
73 AccessKeyID: "test",
74 SecretAccessKey: "test",
75 Region: "test",
76 },
77 wantErr: true,
78 },
79 }
80
81 for _, tc := range testCases {
82 t.Run(tc.name, func(t *testing.T) {
83 err := tc.creds.Validate()
84 if tc.wantErr {
85 assert.Error(t, err)

Callers

nothing calls this directly

Calls 3

ErrorMethod · 0.65
RunMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected