(t *testing.T)
| 26 | } |
| 27 | |
| 28 | func Test_ParseOperations(t *testing.T) { |
| 29 | const ( |
| 30 | shouldNotBeError = false |
| 31 | shouldBeError = true |
| 32 | ) |
| 33 | |
| 34 | tests := []struct { |
| 35 | name string |
| 36 | testFilePath string |
| 37 | expectError bool |
| 38 | }{ |
| 39 | { |
| 40 | "valid create", |
| 41 | "testdata/serialized_operations/valid_create.yaml", |
| 42 | shouldNotBeError, |
| 43 | }, |
| 44 | { |
| 45 | "invalid create", |
| 46 | "testdata/serialized_operations/invalid_create.yaml", |
| 47 | shouldBeError, |
| 48 | }, |
| 49 | { |
| 50 | "valid delete", |
| 51 | "testdata/serialized_operations/valid_delete.yaml", |
| 52 | shouldNotBeError, |
| 53 | }, |
| 54 | { |
| 55 | "invalid delete", |
| 56 | "testdata/serialized_operations/invalid_delete.yaml", |
| 57 | shouldBeError, |
| 58 | }, |
| 59 | { |
| 60 | "valid patch", |
| 61 | "testdata/serialized_operations/valid_patch.yaml", |
| 62 | shouldNotBeError, |
| 63 | }, |
| 64 | { |
| 65 | "invalid patch", |
| 66 | "testdata/serialized_operations/invalid_patch.yaml", |
| 67 | shouldBeError, |
| 68 | }, |
| 69 | } |
| 70 | for _, tt := range tests { |
| 71 | t.Run(tt.name, func(t *testing.T) { |
| 72 | testSpecs := mustReadFile(t, tt.testFilePath) |
| 73 | |
| 74 | _, err := ParseOperations(testSpecs) |
| 75 | if tt.expectError { |
| 76 | require.Error(t, err) |
| 77 | } else { |
| 78 | require.NoError(t, err) |
| 79 | } |
| 80 | }) |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | func Test_PatchOperations(t *testing.T) { |
| 85 | const ( |
nothing calls this directly
no test coverage detected