Skip to content

more test coverage for generate/app - #13892

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
pweil-:generate-app-tests
May 16, 2017
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
pweil-:generate-app-tests

Conversation

@pweil-

@pweil- pweil- commented Apr 25, 2017

Copy link
Copy Markdown

@soltysh related but does not completely resolve #3016

Added some more tests while I was in some of the code.

app.go 64.9->65.5%
builder.go 0->75.4%
componentref.go 0->12.4%

@pweil-

pweil- commented Apr 25, 2017

Copy link
Copy Markdown
Author

[test]

@soltysh soltysh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few nits, but mostly looks good. Thanks for doing this!

Comment thread pkg/generate/app/app_test.go Outdated
imageapi "github.com/openshift/origin/pkg/image/api"

_ "github.com/openshift/origin/pkg/api/install"
"strings"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should go up to other core imports.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I realized I left that in there last night and knew you'd call it out 😄 You're so predictable, @soltysh. I should've left some long ifs in there too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You know me 🚔

val string
expectedReturn bool
}{
{"foo", false},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a comment that you're testing parents inside of the for loop, otherwise someone might miss that there.

{"$foo}", false},
{"foo}", false},
{"{foo", false},
{"${foo", true},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sigh... this makes me 😢, why we allow this? Is it for supporting spaces inside of those or what? @bparees

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i have no idea. @smarterclayton coded IsParameterizableValue, let's ask him.

but it should not be for supporting spaces, regex would handle that. I think it's just a lazy check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So someone can do

oc new-app ruby --name='${name}' -o yaml

And get something they can create a template from

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i don't think that's the question. The question is why the check doesn't look for/require a closing brace.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's exactly my question, currently we're only looking for opening bracket but no accompanying closing one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've spawned #13994 to address this.

Comment thread pkg/generate/app/builder_test.go Outdated
"testing"

imageapi "github.com/openshift/origin/pkg/image/api"
"reflect"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again, up with the core imports.

t.Fatalf("failed parsing empty host url: %v", err)
}

hostPortURL, err := url.Parse("https://www.example.com:80")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how about a non-standard port?

Comment thread pkg/generate/app/builder_test.go Outdated
},
expectedReturn: true,
},
"has legacy envrionment STI_LOCATION": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

environment

Comment thread pkg/generate/app/builder_test.go Outdated
},
expectedReturn: true,
},
"has legacy envrionment STI_BUILDER": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

environment

Comment thread pkg/generate/app/builder_test.go Outdated
},
expectedReturn: true,
},
"has legacy envrionment STI_SCRIPTS_URL": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

environment

@pweil-
pweil- force-pushed the generate-app-tests branch from 8cb79d1 to 1c8795c Compare May 2, 2017 13:06
@pweil-

pweil- commented May 2, 2017

Copy link
Copy Markdown
Author

[test]

@soltysh

soltysh commented May 2, 2017

Copy link
Copy Markdown
Contributor

LGTM

@pweil-

pweil- commented May 2, 2017

Copy link
Copy Markdown
Author

#13942

[test]

@pweil-

pweil- commented May 2, 2017

Copy link
Copy Markdown
Author

re[test]

1 similar comment
@pweil-

pweil- commented May 8, 2017

Copy link
Copy Markdown
Author

re[test]

@pweil-

pweil- commented May 16, 2017

Copy link
Copy Markdown
Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 1c8795c

@openshift-bot

Copy link
Copy Markdown
Contributor

@pweil-

pweil- commented May 16, 2017

Copy link
Copy Markdown
Author

[merge]

@openshift-bot

openshift-bot commented May 16, 2017 •

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/1483/) (Base Commit: b96ef9a) (Image: devenv-rhel7_6232)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 1c8795c

@openshift-bot
openshift-bot merged commit a6f21d9 into openshift:master May 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Increase unit test for pkg/generate/app

5 participants