Skip to content

Commit

Permalink
more comments - take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
GGabriele committed Aug 2, 2023
1 parent cd55b4f commit f97ffbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 88 deletions.
1 change: 0 additions & 1 deletion cmd/common_konnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ func resetKonnectV2(ctx context.Context) error {
if err != nil {
return err
}
dumpConfig.IsConsumerGroupScopedPluginSupported = true
if dumpConfig.KonnectRuntimeGroup == "" {
dumpConfig.KonnectRuntimeGroup = defaultRuntimeGroupName
}
Expand Down
103 changes: 16 additions & 87 deletions tests/integration/dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,125 +82,54 @@ func Test_Dump_SkipConsumers(t *testing.T) {
stateFile string
expectedFile string
skipConsumers bool
runWhen func(t *testing.T)
}{
{
name: "dump with skip-consumers",
name: "3.2 & 3.3 dump with skip-consumers",
stateFile: "testdata/dump/002-skip-consumers/kong.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected.yaml",
skipConsumers: true,
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.2.0 <3.4.0") },
},
{
name: "dump with no skip-consumers",
name: "3.2 & 3.3 dump with no skip-consumers",
stateFile: "testdata/dump/002-skip-consumers/kong.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip.yaml",
skipConsumers: false,
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.2.0 <3.4.0") },
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
runWhen(t, "enterprise", ">=3.2.0 <3.4.0")
teardown := setup(t)
defer teardown(t)

assert.NoError(t, sync(tc.stateFile))

var (
output string
err error
)
if tc.skipConsumers {
output, err = dump(
"--skip-consumers",
"-o", "-",
)
} else {
output, err = dump(
"-o", "-",
)
}
assert.NoError(t, err)

expected, err := readFile(tc.expectedFile)
assert.NoError(t, err)
assert.Equal(t, expected, output)
})
}
}

func Test_Dump_SkipConsumers_34x(t *testing.T) {
tests := []struct {
name string
stateFile string
expectedFile string
skipConsumers bool
}{
{
name: "dump with skip-consumers",
name: "3.4 dump with skip-consumers",
stateFile: "testdata/dump/002-skip-consumers/kong34.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected.yaml",
skipConsumers: true,
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.4.0 <3.5.0") },
},
{
name: "dump with no skip-consumers",
name: "3.4 dump with no skip-consumers",
stateFile: "testdata/dump/002-skip-consumers/kong34.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-34.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip.yaml",
skipConsumers: false,
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.4.0 <3.5.0") },
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
runWhen(t, "enterprise", ">=3.4.0 <3.5.0")
teardown := setup(t)
defer teardown(t)

assert.NoError(t, sync(tc.stateFile))

var (
output string
err error
)
if tc.skipConsumers {
output, err = dump(
"--skip-consumers",
"-o", "-",
)
} else {
output, err = dump(
"-o", "-",
)
}
assert.NoError(t, err)

expected, err := readFile(tc.expectedFile)
assert.NoError(t, err)
assert.Equal(t, expected, output)
})
}
}

func Test_Dump_SkipConsumers_35x(t *testing.T) {
tests := []struct {
name string
stateFile string
expectedFile string
skipConsumers bool
}{
{
name: "dump with skip-consumers",
name: "3.5 dump with skip-consumers",
stateFile: "testdata/dump/002-skip-consumers/kong34.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected.yaml",
skipConsumers: true,
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.5.0") },
},
{
name: "dump with no skip-consumers",
name: "3.5 dump with no skip-consumers",
stateFile: "testdata/dump/002-skip-consumers/kong34.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip-35.yaml",
expectedFile: "testdata/dump/002-skip-consumers/expected-no-skip.yaml",
skipConsumers: false,
runWhen: func(t *testing.T) { runWhen(t, "enterprise", ">=3.5.0") },
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
runWhen(t, "enterprise", ">=3.5.0")
tc.runWhen(t)
teardown := setup(t)
defer teardown(t)

Expand Down

0 comments on commit f97ffbb

Please sign in to comment.