Skip to content

Commit 4e370c8

Browse files
authored
test: Bring back spec_reader tests (#110)
Replaces #104 ---
1 parent 3aa795b commit 4e370c8

File tree

4 files changed

+46
-24
lines changed

4 files changed

+46
-24
lines changed

specs/spec_reader_test.go

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
11
package specs
22

3-
// func TestLoadSpecs(t *testing.T) {
4-
// specReader, err := NewSpecReader("testdata")
5-
// if err != nil {
6-
// t.Fatal(err)
7-
// }
8-
// for fileName, spec := range specReader.sources {
9-
// t.Run(fileName, func(t *testing.T) {
10-
// if !reflect.DeepEqual(spec, testSpecs[fileName]) {
11-
// t.Errorf("expected spec %s to be:\n%v\nbut got:\n%v", fileName, testSpecs[fileName].Spec, spec.Spec)
12-
// }
13-
// })
14-
// }
15-
// }
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
)
8+
9+
var sources = map[string]Source{
10+
"aws.yml": {
11+
Name: "aws",
12+
Path: "aws",
13+
Version: "v1.0.0",
14+
MaxGoRoutines: 10,
15+
Registry: RegistryLocal,
16+
},
17+
}
18+
19+
var destinations = map[string]Destination{
20+
"postgresql.yml": {
21+
Name: "postgresql",
22+
Path: "postgresql",
23+
Version: "v1.0.0",
24+
Registry: RegistryGrpc,
25+
WriteMode: WriteModeOverwrite,
26+
},
27+
}
28+
29+
func TestLoadSpecs(t *testing.T) {
30+
specReader, err := NewSpecReader("testdata")
31+
if err != nil {
32+
t.Fatal(err)
33+
}
34+
35+
require.Equal(t, sources, specReader.sources)
36+
require.Equal(t, destinations, specReader.destinations)
37+
}

specs/spec_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
var testSpecs = map[string]Spec{
10-
"testdata/pg.cq.yml": {
10+
"testdata/postgresql.yml": {
1111
Kind: KindDestination,
1212
Spec: &Destination{
1313
Name: "postgresql",
@@ -17,16 +17,16 @@ var testSpecs = map[string]Spec{
1717
WriteMode: WriteModeOverwrite,
1818
},
1919
},
20-
// "testdata/aws.cq.yml": {
21-
// Kind: KindSource,
22-
// Spec: &Source{
23-
// Name: "aws",
24-
// Path: "aws",
25-
// Version: "v1.0.0",
26-
// MaxGoRoutines: 10,
27-
// Registry: RegistryLocal,
28-
// },
29-
// },
20+
"testdata/aws.yml": {
21+
Kind: KindSource,
22+
Spec: &Source{
23+
Name: "aws",
24+
Path: "aws",
25+
Version: "v1.0.0",
26+
MaxGoRoutines: 10,
27+
Registry: RegistryLocal,
28+
},
29+
},
3030
}
3131

3232
func TestSpecYamlMarshal(t *testing.T) {

0 commit comments

Comments
 (0)