Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the invalid kube yaml causing panic issue #171

Merged
merged 3 commits into from
Apr 18, 2023

Conversation

yangcao77
Copy link
Collaborator

What does this PR do?:

This PR updates the kubeyaml parser to use unmarshal to ensure the kube yaml is in the expected format. to avoid the panic when trying to convert an interface{} into a 'map[string]interface {}'

panic: interface conversion: interface {} is string, not map[string]interface {} [recovered]
	panic: interface conversion: interface {} is string, not map[string]interface {}

Which issue(s) this PR fixes:

for has bug: https://issues.redhat.com/browse/RHTAPBUGS-113

PR acceptance criteria:

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Open new test/doc issues under the devfile/api repo
  • Check each criteria if:
  • There is a separate tracking issue. Add the issue link under the criteria
    or
  • test/doc updates are made as part of this PR
  • If unchecked, explain why it's not needed

How to test changes / Special notes to the reviewer:

Signed-off-by: Stephanie <yangcao@redhat.com>
@openshift-ci openshift-ci bot requested a review from elsony April 18, 2023 08:32
@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03 🎉

Comparison is base (c1b23d2) 61.28% compared to head (d3d4fe8) 61.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #171      +/-   ##
==========================================
+ Coverage   61.28%   61.32%   +0.03%     
==========================================
  Files          37       37              
  Lines        4373     4377       +4     
==========================================
+ Hits         2680     2684       +4     
  Misses       1531     1531              
  Partials      162      162              
Impacted Files Coverage Δ
pkg/devfile/parser/reader.go 92.85% <100.00%> (+0.35%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -121,7 +121,12 @@ func ParseKubernetesYaml(values []interface{}) (KubernetesResources, error) {
return KubernetesResources{}, err
}

kubernetesMap := value.(map[string]interface{})
// kubernetesMap := value.(map[string]interface{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -72,7 +72,9 @@ func TestReadAndParseKubernetesYaml(t *testing.T) {
name string
src YamlSrc
fs *afero.Afero
testParseYamlOnly bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are we setting this? We are using it but i dont see it being set a value

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if tt.testParseYamlOnly {

Signed-off-by: Stephanie <yangcao@redhat.com>
@maysunfaisal
Copy link
Member

@yangcao77 tests failing

Signed-off-by: Stephanie <yangcao@redhat.com>
@yangcao77
Copy link
Collaborator Author

@maysunfaisal fixed the test failure. can you help review again ? thanks

@openshift-ci openshift-ci bot added the lgtm label Apr 18, 2023
@openshift-ci
Copy link

openshift-ci bot commented Apr 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maysunfaisal, yangcao77

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [maysunfaisal,yangcao77]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants