-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Start-build/env and multitag jenkins plugin tests #11252
Conversation
@@ -169,6 +193,80 @@ var _ = g.Describe("[jenkins][Slow] openshift pipeline plugin", func() { | |||
|
|||
g.By("get build console logs and see if succeeded") | |||
err = waitForJenkinsActivity(fmt.Sprintf("http://%s/job/test-plugin-job/1/console", hostPort), "Finished: SUCCESS", 200) | |||
logs, _ := getJenkinsJobLogs(hostPort, "test-plugin-job") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our wires got crossed when we discussed this after scrum.
Rather than inserting the test here, create a new test under g.Context
with something like
g.It("jenkins-plugin test case for env var builds", func() {
And then another like
g.It("jenkins-plugin test case multi tag", func() {
I do think the BeforeSuite
change is good. Bring up Jenkins just once for the (now greater than 1) set of tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, upon further recollection, BeforeSuite
might be too broad. I seem to remember once having that for the force pull tests, and it got called when other tests files ran as well. I might have worked with @mfojtik on that.
After you refactor the test with multiple g.It
's see if keeping it BeforeEach
is sufficient for the test only startup up Jenkins once, where then each g.It
adds the new test job and runs it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not completely crossed! I did understand your desire for additional specs, so I made the BeforeSuite change. However, since env vars were just being added to the existing build trigger step, it made sense (to me at least) to simply extend the scope of the existing test (i.e. test as many features of the build step as possible in a single build).
The tagging test required image streams which were already viable because of that build... it just seemed like a waste not to use them :) . That said, I understand your objection and will refactor to a new spec/build.
@@ -27,6 +27,22 @@ | |||
<authToken></authToken> | |||
<followLog>true</followLog> | |||
<checkForTriggeredDeployments>true</checkForTriggeredDeployments> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In conjunction with the other comment, create a new test job xml file, that just does a build and includes your new env vars
@@ -53,16 +69,62 @@ | |||
<authToken></authToken> | |||
</com.openshift.jenkins.plugins.pipeline.OpenShiftServiceVerifier> | |||
|
|||
<!-- 1 to 1 mapping --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again, a separate test job xml file that just includes what is needed for the multi tag test
@gabemontero I confirmed that BeforeSuite is too broad -- there can only be one in the entire test suite, so I'm interfering with the whole test framework. |
"spec": {}, | ||
"status": { | ||
"dockerImageRepository": "" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to define empty status blocks.
or spec for that matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These have been removed.
<prodStream>origin-nodejs-sample</prodStream> | ||
<prodTag>prod2,prod3,prod4</prodTag> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabemontero do we support both "source/destination" naming conventions as well as this "test/prod" convention? and if so, we should be stripping out usage of the test/prod syntax, not adding more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bparees since I unfortunately originally named the instance variables testTag, prodTag, etc. we have a backwards compatibility issue, with folks at older versions of the plugin potentially having job config's with that old naming convention.
whether that unfortunately reality needs to bleed into new tests we create is certainly a subject for debate.... I tend to agree that we should test with the preferred names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conversely, I'm also fine with this existing, original test being the one test that vets out the backward compatibility pain. But when @jupierce pushes the updates for the new test xml files and breaks out the new tests into separate g.It
sections, they would leverage the new tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right i'm saying we support both names, right? so let's use the new/correct name in our tests.
i'm not super concerned about having backwards compatibility tests for the field name.
On Mon, Oct 10, 2016 at 3:29 PM, Ben Parees notifications@github.com
|
@gabemontero I'll handle the during my refactor. |
Cool / thx @jupierce On Tue, Oct 11, 2016 at 9:37 AM, Justin Pierce notifications@github.com
|
@gabemontero At first pass, it seemed like @bparees request would be easy, but it dawned on me that we are talking about the job.xml here -- not DSL. We support both forms for DSL, but there are no allowances for job.xml to change. |
Yep - let's punt on the test/src and prod/dest xml change for now. |
@gabemontero @jupierce i can live w/ that i guess. confusing for anyone looking at the xml or editing it by hand though. |
yes to your question @bparees and agreed on the unfortunate confusion originally introduced |
ptal @gabemontero @bparees
So far, no luck getting Jenkins to stay up between tests. I know it is possible, but wanted to get basic tests in place before spending more time on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally looks good
If the separate g.It
thing becomes to much of a rabbit hole, I'll back off that request, and we can just launch Jenkins once. I'd still like for the job defs and "tests" to be separated, with different xml files, separate jobs in jenkins, tests separated into different methods that are called from the single g.It
, so that if the framework changes, we already have things factored such that it is trivial to map into separate g.It
calls.
Sound good?
host: serviceIP, | ||
port: port, | ||
} | ||
|
||
jenkinsUri := fmt.Sprintf("http://%s:%s", serviceIP, port) | ||
g.By(fmt.Sprintf("wait for jenkins to come up at %q", jenkinsUri)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is the jenkinsUri
just debug at this point? If so, we don't need to bother with constructing an http url string. Just print the ip and port in the g.By
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next push.
return "", 0, fmt.Errorf("Unable to build request for uri %q: %v", uri, err) | ||
} | ||
|
||
req.SetBasicAuth("admin", "password") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heads up ... assuming my PR ever gets through the merge queue, you'll need to rebase and plug in my retrieval of the password for the jenkins admin user here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem.
post := exutil.ArtifactPath(filename) | ||
err := exutil.VarSubOnFile(pre, post, "PROJECT_NAME", namespace) | ||
o.Expect(err).NotTo(o.HaveOccurred()) | ||
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this distinction re: offset matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offset makes ginkgo show an offset in the call stack when reporting a failure. If you don't use it, you only know the method which failed. If you use it, you can tell exactly which test called the failing method. This is critical to get information about which test failed when a method is being used by many tests.
@@ -27,6 +27,22 @@ | |||
<authToken></authToken> | |||
<followLog>true</followLog> | |||
<checkForTriggeredDeployments>true</checkForTriggeredDeployments> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had originally envisioned a vanilla build test and and then a test with the build env vars .... i'm assuming you are worried about the time already being spent and wanted to consolidate (of course correct my assumption as needed) .... i could be swayed, but i'm inclined to have separate tests, one for vanilla build, one for build with env vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention was indeed to minimize time, but I've split it into two tests per your request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok cool - thx - and yeah, to reiterate what i said in the preface to this latest review, unless you are close or something, definitely switch to the single g.It
if that is the by far easiest or only way to allow us to keep Jenkins up for the duration of the tests
"apiVersion": "v1", | ||
"metadata": { | ||
"name": "origin-nodejs-sample2", | ||
"creationTimestamp": null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need creationTimestamp either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in latest push.
Adding extended tests for openshift/jenkins-plugin#70 (oc exec support) |
On Wed, Oct 12, 2016 at 11:20 AM, Justin Pierce notifications@github.com
|
On Wed, Oct 12, 2016 at 11:49 AM, Gabe Montero gmontero@redhat.com wrote:
Not with this pull, but perhaps a broad find/replace in our extended tests
|
probably, but in general we've just avoided failing tests inside helper methods to avoid this problem, so i don't think it's pervasive. |
Latest push should be close to complete. ptal @gabemontero @bparees
|
Note that tests will not pass until openshift/jenkins-plugin#87 merges |
fyi @csrwng |
@jupierce re: when the test will pass, it is more than just the PR merging (which I just hit the button for). I need to 1) actually cut a new version of the plugin in the official jenkins download center, 2) update our jenkins image to pull in the new version of the plugin when it is ready. The "non PR testing" version of the plugin extended tests work off of official images/plugins. We can play it by ear, but I was hoping to pull in the features from @oatmealraisin, as well as the image stream polling tweak @csrwng mentioned, plus my change for hitting the deploy instantiate endpoint. If all goes well, that should happen by the EOW, but I'm tracking closely, and if things get hung up, I'll expedite accordingly. |
@gabemontero I can comment out the offending tests if you prefer. |
Let's hold on posting the merge comment for a bit and see if the cutting of On Thursday, October 13, 2016, Justin Pierce notifications@github.com
|
@jupierce my fix for the admin password got merged - leading to the merge conflict noted. |
@gabemontero rebased with your password logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good .... only the one item which @jupierce was already aware of and is working on.
jenkinsApplicationPath := exutil.FixturePath("..", "..", "examples", "jenkins", "application-template.json") | ||
err = oc.Run("new-app").Args(jenkinsApplicationPath).Execute() | ||
o.Expect(err).NotTo(o.HaveOccurred()) | ||
oc.Run("new-project").Args(jenkinsNamespace).Execute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jupierce is already working on it, but a clean up of the special namespace for jenkins when the tests are done would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now convinced myself that there is no clean/reliable way to tear down the namespace in Ginkgo. The framework intentionally disallows discourages this behavior. There is even a comment in their repo about how it would help k8s testing: onsi/ginkgo#70 (comment)
That leaves:
(1) Using Ben's new numeric template parameter, allow template to use ephemeral/unique port for the Jenkins server and leave it up for all tests.
(2) Bring up Jenkins on each test.
(3) Put all tests into the same spec.
I'm personally a fan of (2) at this point, so we can keep the specs clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) won't be there any time soon.
On Thu, Oct 13, 2016 at 3:29 PM, Justin Pierce notifications@github.com
|
@bparees @gabemontero The normal Jenkins workflow of restarting itself whenever plugins are installed could make this problematic. Restarting the server can certainly take more than 30 seconds. This makes it likely that Jenkins will be killed in the process of coming up and installing new plugins. Perhaps it would be worth extending the period of the liveness probe to 1 minute or so? |
Assuming I remember the particulars of the liveness probe correctly, @jupierce 's rationale for bumping makes sense to me, pending any mitigating factors I'm presently unaware of. |
First test with 60% reserved for heap instead of 80% has passed. |
@jupierce i assume you're proposing that as a change to the jenkins-ephemeral/persistent templates, nothing to do w/ these extended test changes, right? If so i'm fine with the suggestion. |
@derekwaynecarr the liveness probe failures ocurred under artificial load. Given the constrained memory, the probe failures may be acceptable. |
Extended tests are now passing consistently with the 0.60 ratio of heap to available memory. This change has now been baked into the s2i jenkins image. |
Flake #11517 |
[testextended][extended:core(openshift pipeline plugin)] |
@bparees @gabemontero ptal . travis-ci test is failing due to #11517 . Extended test is successful, but github states it hasn't completed yet, so you will need to visit Jenkins directly to see the complete result. |
[merge] |
[Test]ing while waiting on the merge queue |
#11452 |
Evaluated for origin testextended up to 24eca1b |
Rebased. |
Evaluated for origin test up to 24eca1b |
continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/681/) (Base Commit: 1f62556) (Extended Tests: core(openshift pipeline plugin)) |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10611/) (Base Commit: 1f62556) |
fyi @oatmealraisin |
Flake #11560 |
@bparees can you please tag this pr with the merge tag? |
[merge] |
Evaluated for origin merge up to 24eca1b |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10651/) (Base Commit: 3f5cad6) (Image: devenv-rhel7_5242) |
Adding extended test for:
ptal @bparees @gabemontero