Skip to content

Commit

Permalink
remove resourcesType field which is unnecessary
Browse files Browse the repository at this point in the history
Signed-off-by: Mustafa Abdelrahman <[email protected]>
  • Loading branch information
MustafaSaber committed Jun 15, 2023
1 parent a6ba9c9 commit 8708985
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func TestResourceConversion(tt *testing.T) {
responsesELBv2 fake.ELBv2Outputs
responsesCF fake.CFOutputs
typeLB string
resourceType []string
}{
{
name: "ingress_alb",
Expand Down Expand Up @@ -94,8 +93,7 @@ func TestResourceConversion(tt *testing.T) {
DescribeStacks: fake.R(nil, nil),
CreateStack: fake.R(fake.MockCSOutput("42"), nil),
},
typeLB: awsAdapter.LoadBalancerTypeApplication,
resourceType: []string{"ing"},
typeLB: awsAdapter.LoadBalancerTypeApplication,
},
{
name: "ingress_nlb",
Expand Down Expand Up @@ -148,8 +146,7 @@ func TestResourceConversion(tt *testing.T) {
DescribeStacks: fake.R(nil, nil),
CreateStack: fake.R(fake.MockCSOutput("42"), nil),
},
typeLB: awsAdapter.LoadBalancerTypeNetwork,
resourceType: []string{"ing"},
typeLB: awsAdapter.LoadBalancerTypeNetwork,
}, {
name: "rg_alb",
responsesEC2: fake.EC2Outputs{DescribeInstancesPages: fake.MockDescribeInstancesPagesOutput(
Expand Down Expand Up @@ -201,8 +198,7 @@ func TestResourceConversion(tt *testing.T) {
DescribeStacks: fake.R(nil, nil),
CreateStack: fake.R(fake.MockCSOutput("42"), nil),
},
typeLB: awsAdapter.LoadBalancerTypeApplication,
resourceType: []string{"rg"},
typeLB: awsAdapter.LoadBalancerTypeApplication,
}, {
name: "rg_nlb",
responsesEC2: fake.EC2Outputs{DescribeInstancesPages: fake.MockDescribeInstancesPagesOutput(
Expand Down Expand Up @@ -254,8 +250,7 @@ func TestResourceConversion(tt *testing.T) {
DescribeStacks: fake.R(nil, nil),
CreateStack: fake.R(fake.MockCSOutput("42"), nil),
},
typeLB: awsAdapter.LoadBalancerTypeNetwork,
resourceType: []string{"rg"},
typeLB: awsAdapter.LoadBalancerTypeNetwork,
}, {
name: "ingress_rg_notshared_alb",
responsesEC2: fake.EC2Outputs{DescribeInstancesPages: fake.MockDescribeInstancesPagesOutput(
Expand Down Expand Up @@ -307,8 +302,7 @@ func TestResourceConversion(tt *testing.T) {
DescribeStacks: fake.R(nil, nil),
CreateStack: fake.R(fake.MockCSOutput("42"), nil),
},
typeLB: awsAdapter.LoadBalancerTypeApplication,
resourceType: []string{"rg", "ing"},
typeLB: awsAdapter.LoadBalancerTypeApplication,
}, {
name: "ingress_rg_shared_alb",
responsesEC2: fake.EC2Outputs{DescribeInstancesPages: fake.MockDescribeInstancesPagesOutput(
Expand Down Expand Up @@ -360,8 +354,7 @@ func TestResourceConversion(tt *testing.T) {
DescribeStacks: fake.R(nil, nil),
CreateStack: fake.R(fake.MockCSOutput("42"), nil),
},
typeLB: awsAdapter.LoadBalancerTypeApplication,
resourceType: []string{"rg", "ing"},
typeLB: awsAdapter.LoadBalancerTypeApplication,
}, {
name: "ingress_rg_shared_nlb",
responsesEC2: fake.EC2Outputs{DescribeInstancesPages: fake.MockDescribeInstancesPagesOutput(
Expand Down Expand Up @@ -413,8 +406,7 @@ func TestResourceConversion(tt *testing.T) {
DescribeStacks: fake.R(nil, nil),
CreateStack: fake.R(fake.MockCSOutput("42"), nil),
},
typeLB: awsAdapter.LoadBalancerTypeNetwork,
resourceType: []string{"rg", "ing"},
typeLB: awsAdapter.LoadBalancerTypeNetwork,
},
} {
tt.Run(scenario.name, func(t *testing.T) {
Expand All @@ -439,8 +431,16 @@ func TestResourceConversion(tt *testing.T) {
require.NoError(t, err)

readers := make([]io.Reader, 0)
for _, resourceType := range scenario.resourceType {
f, err := os.Open("./testdata/" + scenario.name + "/" + resourceType + ".yaml")
files, err := os.ReadDir("./testdata/" + scenario.name)
require.NoError(t, err)

// numberOfFiles := len(files) - 1 , TODO: use to compare with metrics later.

for _, file := range files {
if file.Name() == "expected.cf" {
continue
}
f, err := os.Open("./testdata/" + scenario.name + "/" + file.Name())
require.NoError(t, err)
readers = append(readers, f)
defer f.Close()
Expand Down

0 comments on commit 8708985

Please sign in to comment.