Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
test: Refactor integration tests (#450)
Browse files Browse the repository at this point in the history
* test: Refactor integration tests

All integration tests now run from TestIntegration.
This makes the tests faster and remove huge amount of connection
to the database.

Also remove bash magic to test for warnings using grep and do
all the checks on the SDK level.

* chore: Remove old lint.yml

Use only golang_lint.yml and doc_validation.yml that are
managed centerally under cloudquery/.github repo

* chore: update to cq-provider-sdk v0.7.1

* chore: fix golanglint

* test: Add CQ_TEST_CFG to override config in tests

* test: Remove !integration tag

* chore: Remove cq_fetch.yml

* chore: Rename int_test.yml to test_integration.yml
  • Loading branch information
yevgenypats authored Jan 30, 2022
1 parent eef4a94 commit 98f54a2
Show file tree
Hide file tree
Showing 255 changed files with 284 additions and 2,251 deletions.
172 changes: 0 additions & 172 deletions .github/workflows/cq_fetch.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/lint.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: integration_test
# DONT EDIT. This file is synced from https://github.com/cloudquery/.github/.github
name: test_integration

on:
push:
Expand All @@ -10,7 +11,6 @@ on:
jobs:
is_organization_member:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_target'
outputs:
status: ${{ steps.is_organization_member.result }}
steps:
Expand All @@ -22,10 +22,10 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Skip if not member and event is pull_request_target
run: |
echo "user is not part of org. Please run 'go test -tags=integration ./..'"
echo "user is not part of org. Please run 'go test -run=TestIntegration -tags=integration ./..'"
echo "and paste the output in the PR"
integration_test:
test_integration:
needs: is_organization_member
if: github.event_name != 'pull_request_target' || needs.is_organization_member.outputs.status == 'true'
strategy:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

- name: Integration Test
run: |
go test -tags=integration ./...
go test -run=TestIntegration -tags=integration ./...
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
Expand Down
4 changes: 3 additions & 1 deletion client/logger.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package client

import "github.com/hashicorp/go-hclog"
import (
"github.com/hashicorp/go-hclog"
)

type awsLogger struct {
hclog.Logger
Expand Down
27 changes: 0 additions & 27 deletions client/testdata/assume_role.hcl

This file was deleted.

22 changes: 0 additions & 22 deletions client/testdata/default.hcl

This file was deleted.

22 changes: 0 additions & 22 deletions client/testdata/nightly.hcl

This file was deleted.

5 changes: 1 addition & 4 deletions client/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ func AwsMockTestHelper(t *testing.T, table *schema.Table, builder func(*testing.
return &Config{}
},
},
Table: table,
Config: cfg,
SkipEmptyJsonB: options.SkipEmptyJsonB,
Config: cfg,
})
}

Expand All @@ -75,7 +73,6 @@ func AWSTestHelper(t *testing.T, table *schema.Table) {
"test_resource": table,
},
},
Table: table,
Config: cfg,
})

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/wafv2 v1.5.1
github.com/aws/smithy-go v1.9.1
github.com/bxcodec/faker v2.0.1+incompatible
github.com/cloudquery/cq-provider-sdk v0.7.0
github.com/cloudquery/cq-provider-sdk v0.7.1
github.com/cloudquery/faker/v3 v3.7.5
github.com/gocarina/gocsv v0.0.0-20210516172204-ca9e8a8ddea8
github.com/golang/mock v1.6.0
Expand Down Expand Up @@ -145,4 +145,4 @@ require (
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
github.com/cloudquery/cq-provider-sdk v0.7.0 h1:PWERMQi7oUW0rHn/qKvf7cVcOhMB9xgx/i0W3hvoXOc=
github.com/cloudquery/cq-provider-sdk v0.7.0/go.mod h1:T+ngRXzcjJ6otKDGkWnPrHTsZuHUe3KZKtyhSLcvHCs=
github.com/cloudquery/cq-provider-sdk v0.7.1 h1:thKsjnBbeSAXO4nodYR9OFrdXVB243SXptlwp0RQ7ok=
github.com/cloudquery/cq-provider-sdk v0.7.1/go.mod h1:T+ngRXzcjJ6otKDGkWnPrHTsZuHUe3KZKtyhSLcvHCs=
github.com/cloudquery/faker/v3 v3.7.4/go.mod h1:1b8WVG9Gh0T2hVo1a8dWeXfu0AhqSB6J/mmJaesqOeo=
github.com/cloudquery/faker/v3 v3.7.5 h1:G7ANdEEcm8TvAAjIwNWSLrYK36CFCiSlrCqOTGCccL0=
github.com/cloudquery/faker/v3 v3.7.5/go.mod h1:1b8WVG9Gh0T2hVo1a8dWeXfu0AhqSB6J/mmJaesqOeo=
Expand Down
Loading

0 comments on commit 98f54a2

Please sign in to comment.