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

Using PATCH instead of PUT to update PipelineActivity #2309

Closed

Conversation

jtnord
Copy link

@jtnord jtnord commented Nov 22, 2018

Submitter checklist

  • Change is code complete and matches issue description.
  • Change is covered by existing or new tests.

Description

subsumes #2110 where I resolved a merge conflict badly and do not have rights on deniedboardings repo to push the fix. (appologies @msvticket)

This is to avoid http status 409 when other process has updated activity.
Also simplifying a bit by updating once in any case and not zero, one or two times depending on. The zero case didn't happen anyway as far as I could see.

Fixes #1890

Special notes for the reviewer(s)

Which issue this PR fixes

fixes #

@jenkins-x-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: jtnord

If they are not already assigned, you can assign the PR to them by writing /assign @jtnord in a comment when ready.

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:

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

@jtnord
Copy link
Author

jtnord commented Nov 22, 2018

multiple test failures

--- FAIL: TestNewVersionWhileExistingWorkflow (18.30s)
    test_helpers.go:224:
                Error Trace:    test_helpers.go:224
                                                        controller_workflow_integration_test.go:506
                Error:          Missing Promote
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       No Promote found on PipelineActivity jstrachan-myrepo-master-1 for Environment staging
    test_helpers.go:278:
                Error Trace:    test_helpers.go:278
                                                        controller_workflow_integration_test.go:507
                Error:          Not equal:
                                expected: "Running"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Running
                                +
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       PipelineActivity status for jstrachan-myrepo-master-1
    test_helpers.go:224:
                Error Trace:    test_helpers.go:224
                                                        controller_workflow_integration_test.go:515
                Error:          Missing Promote
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       No Promote found on PipelineActivity jstrachan-myrepo-master-2 for Environment staging
    test_helpers.go:278:
                Error Trace:    test_helpers.go:278
                                                        controller_workflow_integration_test.go:516
                Error:          Not equal:
                                expected: "Running"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Running
                                +
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       PipelineActivity status for jstrachan-myrepo-master-2
    test_helpers.go:356:
                Error Trace:    test_helpers.go:356
                                                        controller_workflow_integration_test.go:543
                Error:          Missing Promote
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       No Promote found on PipelineActivity jstrachan-myrepo-master-2 for Environment staging
    test_helpers.go:224:
                Error Trace:    test_helpers.go:224
                                                        controller_workflow_integration_test.go:544
                Error:          Missing Promote
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       No Promote found on PipelineActivity jstrachan-myrepo-master-2 for Environment production
    test_helpers.go:356:
                Error Trace:    test_helpers.go:356
                                                        controller_workflow_integration_test.go:545
                Error:          Missing Promote
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       No Promote found on PipelineActivity jstrachan-myrepo-master-2 for Environment production
    test_helpers.go:366:
                Error Trace:    test_helpers.go:366
                                                        controller_workflow_integration_test.go:546
                Error:          Not equal:
                                expected: "Running"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Running
                                +
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       activity status for PipelineActivity jstrachan-myrepo-master-2
    test_helpers.go:413:
                Error Trace:    test_helpers.go:413
                                                        controller_workflow_integration_test.go:548
                Error:          Expected value not to be nil.
                Test:           TestNewVersionWhileExistingWorkflow
                Messages:       No PullRequest found on repository jstrachan/environment-production for number #1
--- FAIL: TestPromoteToProductionRun (15.12s)
    test_helpers.go:224:
                Error Trace:    test_helpers.go:224
                                                        promote_test.go:286
                                                        promote_test.go:19
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment staging
    test_helpers.go:278:
                Error Trace:    test_helpers.go:278
                                                        promote_test.go:287
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Running"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Running
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity status for myorg-my-app-master-1
    test_helpers.go:278:
                Error Trace:    test_helpers.go:278
                                                        promote_test.go:307
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Succeeded"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Succeeded
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity status for myorg-my-app-master-1
    test_helpers.go:356:
                Error Trace:    test_helpers.go:356
                                                        promote_test.go:313
                                                        promote_test.go:19
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment staging
    test_helpers.go:377:
                Error Trace:    test_helpers.go:377
                                                        promote_test.go:315
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Succeeded"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Succeeded
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity status for myorg-my-app-master-1
    test_helpers.go:378:
                Error Trace:    test_helpers.go:378
                                                        promote_test.go:315
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Succeeded"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Succeeded
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity workflow status for myorg-my-app-master-1
    promote_test.go:60:
                Error Trace:    promote_test.go:60
                Error:          Received unexpected error:
                                invalid JSON document
                Test:           TestPromoteToProductionRun
    test_helpers.go:224:
                Error Trace:    test_helpers.go:224
                                                        promote_test.go:63
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment production
    test_helpers.go:366:
                Error Trace:    test_helpers.go:366
                                                        promote_test.go:64
                Error:          Not equal:
                                expected: "Running"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Running
                                +
                Test:           TestPromoteToProductionRun
                Messages:       activity status for PipelineActivity myorg-my-app-master-1
    test_helpers.go:356:
                Error Trace:    test_helpers.go:356
                                                        promote_test.go:71
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment production
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1c92870]
goroutine 598 [running]:
testing.tRunner.func1(0xc000d56200)
        /usr/local/go/src/testing/testing.go:792 +0x387
panic(0x1f38700, 0x3a57a80)
        /usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/jenkins-x/jx/pkg/jx/cmd_test.TestPromoteToProductionRun(0xc000d56200)
        /home/jenkins/go/src/github.com/jenkins-x/jx/pkg/jx/cmd/promote_test.go:72 +0x600
testing.tRunner(0xc000d56200, 0x2384a10)
        /usr/local/go/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:878 +0x353
FAIL    github.com/jenkins-x/jx/pkg/jx/cmd      178.505s
?       github.com/jenkins-x/jx/pkg/jx/cmd/certmanager  [no test files]
?       github.com/jenkins-x/jx/pkg/jx/cmd/common       [no test files]
?       github.com/jenkins-x/jx/pkg/jx/cmd/mocks        [no test files]
?       github.com/jenkins-x/jx/pkg/jx/cmd/mocks/matchers       [no test files]
?       github.com/jenkins-x/jx/pkg/jx/cmd/templates    [no test files]
ok      github.com/jenkins-x/jx/pkg/kube        15.276s coverage: 30.6% of statements
?       github.com/jenkins-x/jx/pkg/kube/mocks  [no test files]
?       github.com/jenkins-x/jx/pkg/kube/serviceaccount [no test files]
?       github.com/jenkins-x/jx/pkg/kube/services       [no test files]
?       github.com/jenkins-x/jx/pkg/log [no test files]
?       github.com/jenkins-x/jx/pkg/maven       [no test files]
?       github.com/jenkins-x/jx/pkg/nodes       [no test files]
?       github.com/jenkins-x/jx/pkg/pipeline_events     [no test files]
ok      github.com/jenkins-x/jx/pkg/prow        2.769s  coverage: 80.0% of statements
ok      github.com/jenkins-x/jx/pkg/quickstarts 0.537s  coverage: 18.4% of statements
ok      github.com/jenkins-x/jx/pkg/reports     0.291s  coverage: 39.7% of statements
?       github.com/jenkins-x/jx/pkg/spring      [no test files]
?       github.com/jenkins-x/jx/pkg/table       [no test files]
ok      github.com/jenkins-x/jx/pkg/terraform   0.180s  coverage: 6.8% of statements
?       github.com/jenkins-x/jx/pkg/testkube    [no test files]
?       github.com/jenkins-x/jx/pkg/tests       [no test files]
ok      github.com/jenkins-x/jx/pkg/util        15.419s coverage: 24.6% of statements
?       github.com/jenkins-x/jx/pkg/util/mocks  [no test files]
ok      github.com/jenkins-x/jx/pkg/util/system 5.190s  coverage: 33.3% of statements
ok      github.com/jenkins-x/jx/pkg/vault       0.822s  coverage: 55.2% of statements
ok      github.com/jenkins-x/jx/pkg/version     0.273s  coverage: 40.0% of statements
?       github.com/jenkins-x/jx/pkg/workflow    [no test files]
Makefile:94: recipe for target 'test-slow-integration' failed
make: *** [test-slow-integration] Error 1

@pmuir
Copy link
Contributor

pmuir commented Nov 22, 2018 via email

@ccojocar
Copy link
Contributor

/retest

@ccojocar
Copy link
Contributor

/retest

1 similar comment
@ccojocar
Copy link
Contributor

/retest

@ccojocar
Copy link
Contributor

/test bdd

msvticket and others added 4 commits November 28, 2018 12:08
This is to avoid http status 409 when other process has updated activity
This is to avoid http status 409 when other process has updated activity

Fixes jenkins-x#1890
@ccojocar ccojocar force-pushed the deniedboarding-patch_activities branch from 45326db to caa3a8f Compare November 28, 2018 11:20
@ccojocar
Copy link
Contributor

ccojocar commented Nov 28, 2018

@msvticket @jtnord I think these tests needs to be fixed or adapted to PATCH in order to get this in:

--- FAIL: TestPromoteToProductionRun (16.00s)
    test_helpers.go:224:
                Error Trace:    test_helpers.go:224
                                                        promote_test.go:286
                                                        promote_test.go:19
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment staging
    test_helpers.go:278:
                Error Trace:    test_helpers.go:278
                                                        promote_test.go:287
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Running"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Running
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity status for myorg-my-app-master-1
    test_helpers.go:278:
                Error Trace:    test_helpers.go:278
                                                        promote_test.go:307
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Succeeded"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Succeeded
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity status for myorg-my-app-master-1
    test_helpers.go:356:
                Error Trace:    test_helpers.go:356
                                                        promote_test.go:313
                                                        promote_test.go:19
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment staging
    test_helpers.go:377:
                Error Trace:    test_helpers.go:377
                                                        promote_test.go:315
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Succeeded"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Succeeded
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity status for myorg-my-app-master-1
    test_helpers.go:378:
                Error Trace:    test_helpers.go:378
                                                        promote_test.go:315
                                                        promote_test.go:19
                Error:          Not equal:
                                expected: "Succeeded"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Succeeded
                                +
                Test:           TestPromoteToProductionRun
                Messages:       PipelineActivity workflow status for myorg-my-app-master-1
 promote_test.go:60:
                Error Trace:    promote_test.go:60
                Error:          Received unexpected error:
                                invalid JSON document
                Test:           TestPromoteToProductionRun
    test_helpers.go:224:
                Error Trace:    test_helpers.go:224
                                                        promote_test.go:63
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment production
    test_helpers.go:366:
                Error Trace:    test_helpers.go:366
                                                        promote_test.go:64
                Error:          Not equal:
                                expected: "Running"
                                actual  : ""

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -Running
                                +
                Test:           TestPromoteToProductionRun
                Messages:       activity status for PipelineActivity myorg-my-app-master-1
    test_helpers.go:356:
                Error Trace:    test_helpers.go:356
                                                        promote_test.go:71
                Error:          Missing Promote
                Test:           TestPromoteToProductionRun
                Messages:       No Promote found on PipelineActivity myorg-my-app-master-1 for Environment production
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x28a5d40]

goroutine 540 [running]:
testing.tRunner.func1(0xc0004f3400)
        /Users/cosmin/.gvm/gos/go1.11.1/src/testing/testing.go:792 +0x387
panic(0x2b4ca80, 0x46931c0)
        /Users/cosmin/.gvm/gos/go1.11.1/src/runtime/panic.go:513 +0x1b9
github.com/jenkins-x/jx/pkg/jx/cmd_test.TestPromoteToProductionRun(0xc0004f3400)
        /Users/cosmin/go/src/github.com/jenkins-x/jx/pkg/jx/cmd/promote_test.go:72 +0x600
testing.tRunner(0xc0004f3400, 0x2f9f368)
        /Users/cosmin/.gvm/gos/go1.11.1/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
        /Users/cosmin/.gvm/gos/go1.11.1/src/testing/testing.go:878 +0x353

@jenkins-x-bot
Copy link
Contributor

@jtnord: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
serverless-jenkins caa3a8f link /test bdd

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@ccojocar
Copy link
Contributor

ccojocar commented Dec 6, 2018

@jtnord Any plans to complete this PR?

@jtnord
Copy link
Author

jtnord commented Dec 7, 2018

No, this is not my pr as I said in the description

@ccojocar
Copy link
Contributor

ccojocar commented Dec 7, 2018

@jtnord Now it's yours since you started a separate PR. Next time try to push changes in the original PR instead of opening another PR if you don't intend to complete it.

@msvticket Do you mind having a look at the failed tests? Thanks

@jtnord
Copy link
Author

jtnord commented Dec 7, 2018

I have no plans to work on this PR, my effort here was to clear up the mess I made for @msvticket when I made a bad merge conflict.

@jstrachan
Copy link
Member

lets close this for now and we can re-create it again later from a clean branch?

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

Successfully merging this pull request may close these issues.

Possible timing issue between jx promote and jx-resource jenkins plugin
6 participants