Skip to content

Commit

Permalink
resolve concersion test failure
Browse files Browse the repository at this point in the history
Signed-off-by: Stephanie <yangcao@redhat.com>
  • Loading branch information
yangcao77 committed May 13, 2021
1 parent 61e5225 commit b8be6ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
18 changes: 18 additions & 0 deletions pkg/apis/workspaces/v1alpha1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,39 @@ var parentProjectFuzzFunc = func(project *Project, c fuzz.Continue) {
switch c.Intn(3) {
case 0:
c.Fuzz(&project.Git)
if project.Git != nil {
project.Git.CommonProjectSource = CommonProjectSource{}
}
case 1:
c.Fuzz(&project.Github)
if project.Github != nil {
project.Github.CommonProjectSource = CommonProjectSource{}
}
case 2:
c.Fuzz(&project.Zip)
if project.Zip != nil {
project.Zip.CommonProjectSource = CommonProjectSource{}
}
}
}

var projectFuzzFunc = func(project *Project, c fuzz.Continue) {
switch c.Intn(4) {
case 0:
c.Fuzz(&project.Git)
if project.Git != nil {
project.Git.CommonProjectSource = CommonProjectSource{}
}
case 1:
c.Fuzz(&project.Github)
if project.Github != nil {
project.Github.CommonProjectSource = CommonProjectSource{}
}
case 2:
c.Fuzz(&project.Zip)
if project.Zip != nil {
project.Zip.CommonProjectSource = CommonProjectSource{}
}
case 3:
c.Fuzz(&project.Custom)
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/validation/variables/test-fixtures/all/devfile-bad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ variables:
projects:
- name: project1
clonePath: "{{path}}"
sparseCheckoutDirs:
- xyz
- "{{dir}}"
git:
checkoutFrom:
revision: "{{tag}}"
Expand Down
7 changes: 0 additions & 7 deletions pkg/validation/variables/variables_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ func ValidateAndReplaceForProjects(variables map[string]string, projects []v1alp
checkForInvalidError(invalidKeys, err)
}

// Validate project sparse checkout dir
for j := range projects[i].SparseCheckoutDirs {
if projects[i].SparseCheckoutDirs[j], err = validateAndReplaceDataWithVariable(projects[i].SparseCheckoutDirs[j], variables); err != nil {
checkForInvalidError(invalidKeys, err)
}
}

// Validate project source
if err = validateandReplaceForProjectSource(variables, &projects[i].ProjectSource); err != nil {
checkForInvalidError(invalidKeys, err)
Expand Down

0 comments on commit b8be6ae

Please sign in to comment.