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

Fix parallel tests for identifiers #134

Merged
merged 2 commits into from
Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### :gear: Changed
* Fix table and column name limit tests [#134](https://github.com/cloudquery/cq-provider-sdk/pull/134).

## [v0.5.6] - 2021-12-18

Expand Down
19 changes: 11 additions & 8 deletions provider/testing/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,25 @@ func getTablesFromMainTable(table *schema.Table) []string {
}

func testTableIdentifiersForProvider(t *testing.T, prov *provider.Provider) {
t.Parallel()
for _, res := range prov.ResourceMap {
res := res
t.Run(res.Name, func(t *testing.T) {
testTableIdentifiers(t, res)
})
}
t.Run("testTableIdentifiersForProvider", func(t *testing.T) {
t.Parallel()
for _, res := range prov.ResourceMap {
res := res
t.Run(res.Name, func(t *testing.T) {
testTableIdentifiers(t, res)
})
}
})
}

func testTableIdentifiers(t *testing.T, table *schema.Table) {
t.Parallel()
assert.NoError(t, schema.ValidateTable(table))

for _, res := range table.Relations {
res := res
t.Run(res.Name, func(t *testing.T) {
assert.NoError(t, schema.ValidateTable(res))
testTableIdentifiers(t, res)
})
}
}