forked from cloudquery/cloudquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_test.go
More file actions
47 lines (41 loc) · 868 Bytes
/
client_test.go
File metadata and controls
47 lines (41 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// +build integration
package cloudqueryclient
import (
"github.com/cloudquery/cloudquery/providers/aws"
"io/ioutil"
"testing"
)
func TestAllResources(t *testing.T) {
tmpFile, err := ioutil.TempFile("", "*.cloudquery.db")
if err != nil {
t.Fatal(err)
}
if err = tmpFile.Close(); err != nil {
t.Fatal(err)
}
client, err := New("sqlite", tmpFile.Name())
if err != nil {
t.Fatal(err)
}
err = client.Run("./testdata/config.yml")
if err != nil {
t.Fatal(err)
}
var images []aws.Image
tests := []struct {
name string
resource interface{}
count int
}{
{"ec2.images", &images, 1},
}
// test ec2.images
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
res := client.db.Find(tc.resource)
if res.RowsAffected != 1 {
t.Errorf("count(images) should equal 1 but equals %d", res.RowsAffected)
}
})
}
}