Skip to content

Commit

Permalink
feat: Move integration tests to separate package (#2111)
Browse files Browse the repository at this point in the history
* [PoC] Set up integration tests - with setup

# Conflicts:
#	pkg/sdk/pipes_integration_test.go

* Move all remaining integration tests

Just move here. `sdk.` prefix is added automatically by IDE. WIP.

* Introduce temporary testClient function

This allows us to not rename client in all integration tests. WIP.

* Introduce temporary testContext function

This allows us to not rename ctx in all integration tests. WIP.

* Initialize new sdk client for close test

* Fix imports ordering

* Reintroduce context.Background() for helpers

* Move helpers to integration test package part 1 (WIP)

* Use random helper functions from integration tests package

* Use helper functions from integration tests package (WIP)

* Use helper functions from integration tests package part 2 (WIP)

* Use helper functions from integration tests package part 3 (WIP)

* Export utility methods from sdk

* Use temporarily exported error

* Use helper functions from integration tests package part 4 (WIP)

* Use helper functions from integration tests package part 5 (WIP)

* Use helper functions from integration tests package part 6 (WIP)

* Use helper functions from integration tests package part 7 (WIP)

* Prune old helper

* Fix last export problems

* Fix linters

* Add explanatory comments

* Rename package
  • Loading branch information
sfc-gh-asawicki committed Oct 11, 2023
1 parent 8311925 commit 2755589
Show file tree
Hide file tree
Showing 39 changed files with 3,291 additions and 3,045 deletions.
4 changes: 2 additions & 2 deletions pkg/sdk/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ type ForeignKeyOnAction struct {
func (row *propertyRow) toBoolProperty() *BoolProperty {
var value bool
if row.Value != "" && row.Value != "null" {
value = toBool(row.Value)
value = ToBool(row.Value)
} else {
value = false
}
var defaultValue bool
if row.DefaultValue != "" && row.Value != "null" {
defaultValue = toBool(row.DefaultValue)
defaultValue = ToBool(row.DefaultValue)
} else {
defaultValue = false
}
Expand Down
85 changes: 0 additions & 85 deletions pkg/sdk/conversion_functions_integration_test.go

This file was deleted.

46 changes: 23 additions & 23 deletions pkg/sdk/external_tables_dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,50 +250,50 @@ func (v TagAssociationRequest) toOpts() TagAssociation {
}
}

func (v *CreateExternalTableRequest) toOpts() *CreateExternalTableOptions {
columns := make([]ExternalTableColumn, len(v.columns))
if v.columns != nil {
for i, c := range v.columns {
func (s *CreateExternalTableRequest) toOpts() *CreateExternalTableOptions {
columns := make([]ExternalTableColumn, len(s.columns))
if s.columns != nil {
for i, c := range s.columns {
columns[i] = c.toOpts()
}
}

var fileFormat []ExternalTableFileFormat
if v.fileFormat != nil {
fileFormat = []ExternalTableFileFormat{v.fileFormat.toOpts()}
if s.fileFormat != nil {
fileFormat = []ExternalTableFileFormat{s.fileFormat.toOpts()}
}

var cloudProviderParams *CloudProviderParams
if v.cloudProviderParams != nil {
cloudProviderParams = v.cloudProviderParams.toOpts()
if s.cloudProviderParams != nil {
cloudProviderParams = s.cloudProviderParams.toOpts()
}

var rowAccessPolicy *RowAccessPolicy
if v.rowAccessPolicy != nil {
rowAccessPolicy = v.rowAccessPolicy.toOpts()
if s.rowAccessPolicy != nil {
rowAccessPolicy = s.rowAccessPolicy.toOpts()
}

tag := make([]TagAssociation, len(v.tag))
if v.tag != nil {
for i, t := range v.tag {
tag := make([]TagAssociation, len(s.tag))
if s.tag != nil {
for i, t := range s.tag {
tag[i] = t.toOpts()
}
}

return &CreateExternalTableOptions{
OrReplace: v.orReplace,
IfNotExists: v.ifNotExists,
name: v.name,
OrReplace: s.orReplace,
IfNotExists: s.ifNotExists,
name: s.name,
Columns: columns,
CloudProviderParams: cloudProviderParams,
Location: v.location,
RefreshOnCreate: v.refreshOnCreate,
AutoRefresh: v.autoRefresh,
Pattern: v.pattern,
Location: s.location,
RefreshOnCreate: s.refreshOnCreate,
AutoRefresh: s.autoRefresh,
Pattern: s.pattern,
FileFormat: fileFormat,
AwsSnsTopic: v.awsSnsTopic,
CopyGrants: v.copyGrants,
Comment: v.comment,
AwsSnsTopic: s.awsSnsTopic,
CopyGrants: s.copyGrants,
Comment: s.comment,
RowAccessPolicy: rowAccessPolicy,
Tag: tag,
}
Expand Down
Loading

0 comments on commit 2755589

Please sign in to comment.