Fix [JenkinsTests JenkinsBuild] tests#11484
Conversation
| t.create('build found (view)') | ||
| .get( | ||
| '/build.json?jobUrl=https://jenkins.sqlalchemy.org/view/alembic/job/alembic_coverage/', | ||
| '/build.json?jobUrl=https://ci.hibernate.org/view/Main/job/hibernate-search/job/main', |
There was a problem hiding this comment.
The Eclipse JGit example doesn't support views, so I've gone with yet another example here.
But more interestingly, one might wonder why this test wasn't failing, even if https://jenkins.sqlalchemy.org/view/alembic/job/alembic_coverage/ no longer exists? The docs for Joi.string() indicate:
Generates a schema object that matches a string data type. Note that empty strings are not allowed by default and must be enabled with allow('').
The call to Joi.string().allow('unstable') was essentially allowing any string, and redundantly adding unstable to the permissive whitelist. Whatever was returned by the badge would always pass the test. Instead, we should use Joi.equal('unstable').
However, all this extra machinery is not necessary, as isBuildStatus already includes unstable:
shields/services/build-status.js
Line 18 in d3a8267
There are other places where we're misusing Joi.string().allow() in our codebase, I'll fix in a follow-up PR.
Well, #11447 didn't last very long. sqlalchemy seems to be changing a lot of things on their Jenkins instance, I've seen a lot of disabled and deleted jobs. Let's stop using it in tests for the time being.
Eclipse JGit has been stable for years (see this test which is 6 years old:
shields/services/jenkins/jenkins-build.tester.js
Line 22 in d3a8267