Skip to content

Commit 06ce6ed

Browse files
NETIZEN-11NETIZEN-11
authored andcommitted
Fix GitHub Issue kptdev#4432: Resolve Kubernetes version mismatch, YAML serialization, result classification, and test YAML parsing
Fixes applied: 1. Kubernetes Dependency Alignment - Updated all k8s.io modules to v0.35.0 2. YAML Serialization Fix - Added yaml tags alongside json tags in RenderStatus, PipelineStepResult, ResultItem 3. Correct Result Classification Logic - Updated extractResultsFromFnResults to use severity instead of ExitCode 4. Test YAML Parsing Fix - Fixed yaml.MustParse test input with proper multiline YAML Result: Eliminates dependency/API mismatch, ensures correct YAML output, fixes logic bug in result classification, makes tests valid and reliable Closes: kptdev#4432 Signed-off-by: NETIZEN-11 <niteshkumar121411@gmail.com> Signed-off-by: NETIZEN-11 <kumarnitesh121411@gmail.com>
1 parent 539beb3 commit 06ce6ed

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

internal/fnruntime/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ func NewConfigMap(data map[string]string) (*yaml.RNode, error) {
228228
return nil, nil
229229
}
230230
// create a ConfigMap only for configMap config
231-
configMap := yaml.MustParse(`
232-
apiVersion: v1
231+
configMapYAML := `apiVersion: v1
233232
kind: ConfigMap
234233
metadata:
235234
name: function-input
236235
data: {}
237-
`)
236+
`
237+
configMap := yaml.MustParse(configMapYAML)
238238
if err := node.VisitFields(func(node *yaml.MapNode) error {
239239
v := node.Value.YNode()
240240
v.Tag = yaml.NodeTagString

internal/util/render/executor_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,12 +812,10 @@ func TestCreateResultItem(t *testing.T) {
812812
assert.Empty(t, result.Resource)
813813

814814
// Test with resource
815-
resource := yaml.MustParse(`
816-
apiVersion: v1
815+
resource := yaml.MustParse(`apiVersion: v1
817816
kind: ConfigMap
818817
metadata:
819-
name: test
820-
`)
818+
name: test`)
821819
resultWithResource := createResultItem(resource, "resource processed", "info")
822820
assert.Equal(t, "resource processed", resultWithResource.Message)
823821
assert.Equal(t, "info", resultWithResource.Severity)

internal/util/update/merge3/strategy_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@ import (
2323
)
2424

2525
func TestEqualWillSkip(t *testing.T) {
26-
orig := yaml.MustParse(`
27-
apiVersion: v1
26+
origYAML := `apiVersion: v1
2827
kind: ConfigMap
2928
metadata:
3029
name: test
3130
data:
3231
foo.txt: "bar"
33-
`)
32+
`
33+
orig := yaml.MustParse(origYAML)
3434
dest := orig.Copy()
3535

3636
strategy := GetHandlingStrategy(orig, nil, dest)
3737
assert.Equal(t, filters.Skip, strategy)
3838
}
3939

4040
func TestNotEqualWillKeepDest(t *testing.T) {
41-
orig := yaml.MustParse(`
42-
apiVersion: v1
41+
origYAML := `apiVersion: v1
4342
kind: ConfigMap
4443
metadata:
4544
name: test
4645
data:
4746
foo.txt: "bar"
48-
`)
47+
`
48+
orig := yaml.MustParse(origYAML)
4949
dest := orig.Copy()
5050
dest.SetDataMap(map[string]string{"foo.txt": "baz"})
5151

0 commit comments

Comments
 (0)