github-branch-source-plugin icon indicating copy to clipboard operation
github-branch-source-plugin copied to clipboard

address potential flake in GithubAppCredentialsTest

Open jtnord opened this issue 3 years ago • 3 comments

calling setLabels on an agent will not persist the node.

in older versions of Jenkins the tests would be less flaky as adding any Node would cause all labels to be re-evaluated, so when creating a few agents and adding labels in a loop the last one created would at least deterministically ensure that all previous agents labels where correct.

However since 2.332 (jenkinsci/jenkins#5882) only labels part of a node added or removed would be updated, and when creating the agents they where created without labels, which where added later.

This has the potential to cause tests to be flaky depending on when the periodic trimLabels was called (or at least on other timing related things)

Additionally creating agents and waiting for them to come oneline is slow. A job can be scheduled and the pipeline will run and then wait for the node to be available, so we can do other things whilst the agent is connecting.

Description

A brief summary describing the changes in this pull request. See JENKINS-XXXXX for further information.

Submitter checklist

  • [ ] Link to JIRA ticket in description, if appropriate.
  • [ ] Change is code complete and matches issue description
  • [ ] Automated tests have been added to exercise the changes
  • [ ] Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • [ ] Run the changes and verify that the change matches the issue description
  • [ ] Reviewed the code
  • [ ] Verified that the appropriate tests have been written or valid explanation given

Documentation changes

  • [ ] Link to jenkins.io PR, or an explanation for why no doc changes are needed

Users/aliases to notify

jtnord avatar May 11 '22 17:05 jtnord

Is

https://github.com/jenkinsci/github-branch-source-plugin/blob/d4d268cc4e1d504efdf3aea953d50c09b529757c/src/test/java/org/jenkinsci/plugins/github_branch_source/GithubAppCredentialsTest.java#L551

safe in case the agent has not yet connected?

probably not - where it is used the agent is either already connected (a build has used the agent and completed) or the test has slepts for at least 21 seconds. I guess it could take more than 21 seconds for an agent to connect however.

jtnord avatar May 18 '22 17:05 jtnord

Hmm, seems to fail now.

jglick avatar May 18 '22 23:05 jglick

Hmm, seems to fail now.

Yup, how ironic... should not have been caused by this change (may always have been slightly flakey) will need some more investigation, so moving to draft.

jtnord avatar May 19 '22 08:05 jtnord

obsolete

jtnord avatar Sep 06 '22 17:09 jtnord