Skip to content

Commit

Permalink
Merge pull request #3422 from banzaicloud/chore/relocate-gorm-test-stuff
Browse files Browse the repository at this point in the history
Relocated pkg/sdk/gorm->pkg/gorm
  • Loading branch information
sagikazarmark authored Feb 4, 2021
2 parents 2aeedca + dfd7657 commit 2c269c2
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/banzaicloud/pipeline/internal/cluster"
"github.com/banzaicloud/pipeline/internal/cluster/distribution/eks"
"github.com/banzaicloud/pipeline/internal/cluster/distribution/eks/eksmodel"
sdkgormtest "github.com/banzaicloud/pipeline/pkg/sdk/gorm/test"
pkggormtest "github.com/banzaicloud/pipeline/pkg/gorm/test"
)

type fakeImageSelector struct {
Expand Down Expand Up @@ -69,7 +69,7 @@ func TestNodePoolProcessorProcessNewNodePool(t *testing.T) {
caseDescription: "cluster not found error -> error",
input: inputType{
p: &nodePoolProcessor{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand All @@ -89,7 +89,7 @@ func TestNodePoolProcessorProcessNewNodePool(t *testing.T) {
caseDescription: "database error -> error",
input: inputType{
p: &nodePoolProcessor{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestNodePoolProcessorProcessNewNodePool(t *testing.T) {
caseDescription: "select image error -> error",
input: inputType{
p: &nodePoolProcessor{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestNodePoolProcessorProcessNewNodePool(t *testing.T) {
caseDescription: "subnet error -> error",
input: inputType{
p: &nodePoolProcessor{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestNodePoolProcessorProcessNewNodePool(t *testing.T) {
caseDescription: "success",
input: inputType{
p: &nodePoolProcessor{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/banzaicloud/pipeline/internal/cluster/clusteradapter/clustermodel"
"github.com/banzaicloud/pipeline/internal/cluster/distribution/eks"
"github.com/banzaicloud/pipeline/internal/cluster/distribution/eks/eksmodel"
sdkgormtest "github.com/banzaicloud/pipeline/pkg/sdk/gorm/test"
pkggormtest "github.com/banzaicloud/pipeline/pkg/gorm/test"
)

func setUpDatabase(t *testing.T) *gorm.DB {
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestNodePoolStoreCreateNodePool(t *testing.T) {
},
input: inputType{
s: &nodePoolStore{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(t, &eksmodel.EKSClusterModel{}).DB,
},
ctx: context.Background(),
Expand All @@ -105,7 +105,7 @@ func TestNodePoolStoreCreateNodePool(t *testing.T) {
expectedError: errors.New("fetching cluster from database failed: test error"),
input: inputType{
s: &nodePoolStore{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&clustermodel.ClusterModel{},
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestNodePoolStoreCreateNodePool(t *testing.T) {
expectedError: errors.New("creating node pool in database failed: no such table: amazon_node_pools"),
input: inputType{
s: &nodePoolStore{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&clustermodel.ClusterModel{},
Expand Down Expand Up @@ -170,7 +170,7 @@ func TestNodePoolStoreCreateNodePool(t *testing.T) {
expectedError: nil,
input: inputType{
s: &nodePoolStore{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&clustermodel.ClusterModel{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/banzaicloud/pipeline/internal/cluster"
"github.com/banzaicloud/pipeline/internal/cluster/distribution/eks"
"github.com/banzaicloud/pipeline/internal/cluster/distribution/eks/eksmodel"
sdkgormtest "github.com/banzaicloud/pipeline/pkg/sdk/gorm/test"
pkggormtest "github.com/banzaicloud/pipeline/pkg/gorm/test"
)

func TestNodePoolValudatorValidateNewNodePool(t *testing.T) {
Expand All @@ -46,7 +46,7 @@ func TestNodePoolValudatorValidateNewNodePool(t *testing.T) {
expectedError: errors.New("cluster model is inconsistent"),
input: inputType{
v: &nodePoolValidator{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand All @@ -63,7 +63,7 @@ func TestNodePoolValudatorValidateNewNodePool(t *testing.T) {
expectedError: errors.New("failed to get cluster info: test error"),
input: inputType{
v: &nodePoolValidator{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand All @@ -81,7 +81,7 @@ func TestNodePoolValudatorValidateNewNodePool(t *testing.T) {
expectedError: errors.New("invalid node pool creation request"),
input: inputType{
v: &nodePoolValidator{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand All @@ -108,7 +108,7 @@ func TestNodePoolValudatorValidateNewNodePool(t *testing.T) {
expectedError: nil,
input: inputType{
v: &nodePoolValidator{
db: sdkgormtest.NewFakeDatabase(t).
db: pkggormtest.NewFakeDatabase(t).
CreateTablesFromEntities(
t,
&eksmodel.EKSClusterModel{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

"github.com/banzaicloud/pipeline/internal/cluster/clusteradapter/clustermodel"
"github.com/banzaicloud/pipeline/internal/cluster/distribution/eks/eksmodel"
sdkgormtest "github.com/banzaicloud/pipeline/pkg/sdk/gorm/test"
pkggormtest "github.com/banzaicloud/pipeline/pkg/gorm/test"
)

func newTestEKSCluster(
Expand Down Expand Up @@ -76,8 +76,8 @@ func newTestEKSCluster(
return eksCluster
}

func newTestEKSClusterDatabase(t *testing.T) *sdkgormtest.FakeDatabase {
return sdkgormtest.NewFakeDatabase(t).CreateTablesFromEntities(
func newTestEKSClusterDatabase(t *testing.T) *pkggormtest.FakeDatabase {
return pkggormtest.NewFakeDatabase(t).CreateTablesFromEntities(
t,
&clustermodel.ClusterModel{},
&clustermodel.ScaleOptions{},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2c269c2

Please sign in to comment.