From d01141c42a8dba8d9d55f1f895efa795a833a666 Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Mon, 27 May 2024 16:02:05 +0200 Subject: [PATCH] fix: correct plugins config comparison Ref: https://github.com/Kong/go-database-reconciler/pull/93 --- go.mod | 2 +- go.sum | 4 ++-- tests/integration/diff_test.go | 23 +++++++++++++++++++ .../diff/004-no-diff-plugin/kong.yaml | 8 +++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 tests/integration/testdata/diff/004-no-diff-plugin/kong.yaml diff --git a/go.mod b/go.mod index 0e8f515eb..b6ffb6059 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/fatih/color v1.15.0 github.com/google/go-cmp v0.6.0 github.com/kong/go-apiops v0.1.33 - github.com/kong/go-database-reconciler v1.11.0 + github.com/kong/go-database-reconciler v1.12.0 github.com/kong/go-kong v0.55.0 github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 1e0295053..b4b5d2b36 100644 --- a/go.sum +++ b/go.sum @@ -190,8 +190,8 @@ github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y7 github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kong/go-apiops v0.1.33 h1:Y7IVksHPdHcXM6C+gPc25JiY4KRgYDAOn/jTx3sDU1k= github.com/kong/go-apiops v0.1.33/go.mod h1:o8lzBtbCLSXCMKzzqR8dcBhB7yzPs+9csAMZ1T1hsL0= -github.com/kong/go-database-reconciler v1.11.0 h1:AowvG85lOWMZSCMZ9UpCGLAYoq/lXvoXJGc6BXH2+qU= -github.com/kong/go-database-reconciler v1.11.0/go.mod h1:fX9SV2ukbuUdVw2h1rakWTi/DUxAV9cbj4QWttoiRrc= +github.com/kong/go-database-reconciler v1.12.0 h1:8+mt2VX/j5uTByPF0dC7Xsh9LscaPjxxXErzaKbL2ik= +github.com/kong/go-database-reconciler v1.12.0/go.mod h1:fX9SV2ukbuUdVw2h1rakWTi/DUxAV9cbj4QWttoiRrc= github.com/kong/go-kong v0.55.0 h1:lonKRzsDGk12dh9E+y+pWnY2ThXhKuMHjzBHSpCvQLw= github.com/kong/go-kong v0.55.0/go.mod h1:i1cMgTu6RYPHSyMpviShddRnc+DML/vlpgKC00hr8kU= github.com/kong/go-slugify v1.0.0 h1:vCFAyf2sdoSlBtLcrmDWUFn0ohlpKiKvQfXZkO5vSKY= diff --git a/tests/integration/diff_test.go b/tests/integration/diff_test.go index e033c0038..347ed9d17 100644 --- a/tests/integration/diff_test.go +++ b/tests/integration/diff_test.go @@ -10,6 +10,12 @@ import ( ) var ( + emptyOutput = `Summary: + Created: 0 + Updated: 0 + Deleted: 0 +` + expectedOutputMasked = `updating service svc1 { "connect_timeout": 60000, "enabled": true, @@ -742,3 +748,20 @@ func Test_Diff_Unmasked_NewerThan3x(t *testing.T) { }) } } + +// test scope: +// - 3.5 +func Test_Diff_NoDiffUnorderedArray(t *testing.T) { + runWhen(t, "enterprise", ">=3.5.0") + setup(t) + + // test that the diff command does not return any changes when + // array fields are not sorted. + stateFile := "testdata/diff/004-no-diff-plugin/kong.yaml" + assert.NoError(t, sync(stateFile, "--timeout", "60")) + + out, err := diff(stateFile) + assert.NoError(t, err) + assert.Equal(t, emptyOutput, out) + reset(t) +} diff --git a/tests/integration/testdata/diff/004-no-diff-plugin/kong.yaml b/tests/integration/testdata/diff/004-no-diff-plugin/kong.yaml new file mode 100644 index 000000000..2d1234397 --- /dev/null +++ b/tests/integration/testdata/diff/004-no-diff-plugin/kong.yaml @@ -0,0 +1,8 @@ +_format_version: "3.0" +plugins: + - name: openid-connect + config: + extra_jwks_uris: + - https://foo.com/baz + - https://foo.com/bar + issuer: https://test.com \ No newline at end of file