diff --git a/internal/dorkly/reconcile.go b/internal/dorkly/reconcile.go index decad6a..8403733 100644 --- a/internal/dorkly/reconcile.go +++ b/internal/dorkly/reconcile.go @@ -155,9 +155,12 @@ func reconcile(old, new RelayArchive) (RelayArchive, error) { newFlag.Version++ logger.With("env", envKey).With("flag", flagKey). Infof("Found modified flag. Version %d->%d", oldFlag.Version, newFlag.Version) - newEnv.data.Flags[flagKey] = newFlag shouldChangeDataId = true + } else { + logger.With("env", envKey).With("flag", flagKey).With("version", newFlag.Version). + Infof("Found existing unchanged flag") } + newEnv.data.Flags[flagKey] = newFlag } if shouldChangeDataId { diff --git a/internal/dorkly/reconcile_test.go b/internal/dorkly/reconcile_test.go index 8fc9ab8..2cde48a 100644 --- a/internal/dorkly/reconcile_test.go +++ b/internal/dorkly/reconcile_test.go @@ -21,8 +21,8 @@ func Test_Reconcile(t *testing.T) { env(env("staging").version(1).dataId(1). flag(booleanFlag("flag1").variation(false).version(1))), new: relayArchive(). - env(env("staging").version(1).dataId(1). - flag(booleanFlag("flag1").variation(false).version(1))), + env(env("staging"). + flag(booleanFlag("flag1").variation(false))), expected: relayArchive(). env(env("staging").version(1).dataId(1). flag(booleanFlag("flag1").variation(false).version(1))), @@ -34,8 +34,8 @@ func Test_Reconcile(t *testing.T) { env(env("staging").version(1).dataId(1). flag(booleanFlag("flag1").variation(false).version(1))), new: relayArchive(). - env(env("staging").version(1).dataId(1). - flag(booleanFlag("flag1").variation(true).version(1))), + env(env("staging"). + flag(booleanFlag("flag1").variation(true))), expected: relayArchive(). env(env("staging").version(1).dataId(2). flag(booleanFlag("flag1").variation(true).version(2))), @@ -47,9 +47,9 @@ func Test_Reconcile(t *testing.T) { env(env("staging").version(1).dataId(1). flag(booleanFlag("flag1").variation(false).version(1))), new: relayArchive(). - env(env("staging").version(1).dataId(1). - flag(booleanFlag("flag1").variation(false).version(1)). - flag(booleanFlag("flag2").variation(true).version(1)), + env(env("staging"). + flag(booleanFlag("flag1").variation(false)). + flag(booleanFlag("flag2").variation(true)), ), expected: relayArchive(). env(env("staging").version(1).dataId(2). @@ -64,7 +64,7 @@ func Test_Reconcile(t *testing.T) { env(env("staging").version(1).dataId(1). flag(booleanFlag("flag1").variation(false).version(1))), new: relayArchive(). - env(env("staging").version(1).dataId(1)), + env(env("staging").version(1)), expected: relayArchive(). env(env("staging").version(1).dataId(2). flag(booleanFlag("flag1").variation(false).version(2).deleted(true))),