fix(tests) (#936)

This commit is contained in:
Luigi Operoso 2023-11-19 14:04:23 +01:00 committed by GitHub
parent 63e8a76b95
commit 8d61604b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View File

@ -96,7 +96,7 @@ jenkins:
# - name: workflow-aggregator # - name: workflow-aggregator
# version: 596.v8c21c963d92d # version: 596.v8c21c963d92d
# - name: git # - name: git
# version: 5.2.0 # version: 5.2.1
# - name: job-dsl # - name: job-dsl
# version: "1.85" # version: "1.85"
# - name: configuration-as-code # - name: configuration-as-code

View File

@ -2,7 +2,7 @@ package plugins
const ( const (
configurationAsCodePlugin = "configuration-as-code:1700.v6f448841296e" configurationAsCodePlugin = "configuration-as-code:1700.v6f448841296e"
gitPlugin = "git:5.2.0" gitPlugin = "git:5.2.1"
jobDslPlugin = "job-dsl:1.85" jobDslPlugin = "job-dsl:1.85"
kubernetesPlugin = "kubernetes:4029.v5712230ccb_f8" kubernetesPlugin = "kubernetes:4029.v5712230ccb_f8"
kubernetesCredentialsProviderPlugin = "kubernetes-credentials-provider:1.234.vf3013b_35f5b_a" kubernetesCredentialsProviderPlugin = "kubernetes-credentials-provider:1.234.vf3013b_35f5b_a"

View File

@ -5,6 +5,8 @@ setup() {
#bats test_tags=phase:helm #bats test_tags=phase:helm
@test "2.1 Install helm chart with options" { @test "2.1 Install helm chart with options" {
# The kind storage class provider needs some sec to delete the old pvc
sleep 30
run ${HELM} dependency update chart/jenkins-operator run ${HELM} dependency update chart/jenkins-operator
assert_success assert_success
run ${KUBECTL} label node jenkins-control-plane batstest=yep run ${KUBECTL} label node jenkins-control-plane batstest=yep

View File

@ -25,7 +25,7 @@ const e2e = "e2e"
var expectedBasePluginsList = []plugins.Plugin{ var expectedBasePluginsList = []plugins.Plugin{
plugins.Must(plugins.New("configuration-as-code:1700.v6f448841296e")), plugins.Must(plugins.New("configuration-as-code:1700.v6f448841296e")),
plugins.Must(plugins.New("git:5.2.0")), plugins.Must(plugins.New("git:5.2.1")),
plugins.Must(plugins.New("kubernetes:4029.v5712230ccb_f8")), plugins.Must(plugins.New("kubernetes:4029.v5712230ccb_f8")),
plugins.Must(plugins.New("kubernetes-credentials-provider:1.234.vf3013b_35f5b_a")), plugins.Must(plugins.New("kubernetes-credentials-provider:1.234.vf3013b_35f5b_a")),
plugins.Must(plugins.New("job-dsl:1.85")), plugins.Must(plugins.New("job-dsl:1.85")),

View File

@ -77,12 +77,12 @@ var _ = Describe("Jenkins Controller with security validator", func() {
invalidPlugins = []v1alpha2.Plugin{ invalidPlugins = []v1alpha2.Plugin{
{Name: "simple-theme-plugin", Version: "0.6"}, {Name: "simple-theme-plugin", Version: "0.6"},
{Name: "audit-trail", Version: "3.8"}, {Name: "audit-trail", Version: "3.8"},
{Name: "github", Version: "1.31.0"}, {Name: "github", Version: "1.36.0"},
} }
validPlugins = []v1alpha2.Plugin{ validPlugins = []v1alpha2.Plugin{
{Name: "simple-theme-plugin", Version: "136.v23a_15f86c53d"}, {Name: "simple-theme-plugin", Version: "136.v23a_15f86c53d"},
{Name: "audit-trail", Version: "3.11"}, {Name: "audit-trail", Version: "3.11"},
{Name: "github", Version: "1.36.0"}, {Name: "github", Version: "1.37.3.1"},
} }
) )
@ -117,7 +117,7 @@ var _ = Describe("Jenkins Controller with security validator", func() {
jenkins := e2e.RenderJenkinsCR(jenkinsCRName, namespace.Name, seedJobs, groovyScripts, casc, "") jenkins := e2e.RenderJenkinsCR(jenkinsCRName, namespace.Name, seedJobs, groovyScripts, casc, "")
jenkins.Spec.Master.Plugins = invalidPlugins jenkins.Spec.Master.Plugins = invalidPlugins
jenkins.Spec.ValidateSecurityWarnings = true jenkins.Spec.ValidateSecurityWarnings = true
Expect(e2e.K8sClient.Create(context.TODO(), jenkins)).Should(MatchError("admission webhook \"vjenkins.kb.io\" denied the request: security vulnerabilities detected in the following user-defined plugins: \ngithub:1.31.0")) Expect(e2e.K8sClient.Create(context.TODO(), jenkins)).Should(MatchError("admission webhook \"vjenkins.kb.io\" denied the request: security vulnerabilities detected in the following user-defined plugins: \ngithub:1.36.0"))
}) })
}) })
Context("When Jenkins CR doesn't contain plugins with security warnings", func() { Context("When Jenkins CR doesn't contain plugins with security warnings", func() {