-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix
kv
equality check for empty values
We did not distinguish between an entry with an empty value vs a non-existent key. This caused resource labels/annotations to not get updated in some cases. Signed-off-by: Utku Ozdemir <[email protected]>
- Loading branch information
1 parent
ce09295
commit eea1d62
Showing
2 changed files
with
25 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
package kv_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/cosi-project/runtime/pkg/resource/internal/kv" | ||
) | ||
|
||
func TestEqualSameLenEmptyValue(t *testing.T) { | ||
var kv1, kv2 kv.KV | ||
|
||
kv1.Set("a", "") | ||
kv2.Set("b", "") | ||
|
||
equal := kv1.Equal(kv2) | ||
|
||
assert.False(t, equal, "Expected kv1 and kv2 to be not equal") | ||
} |