Skip to content

Commit

Permalink
Merge pull request #9085 from rundeck/exp/blocklist-test-replacement
Browse files Browse the repository at this point in the history
RUN-2317: convert plugin blocklist test
  • Loading branch information
gschueler committed Apr 30, 2024
2 parents 95372a5 + 7ecbcf4 commit 5f9622b
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 910 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,6 @@ workflows:
command: bash test/run-docker-ansible-tests.sh
<<: *require-build
<<: *slack-defaults
- test-docker:
name: Blocklist Test
command: bash test/run-docker-plugin-blocklist-test.sh
<<: *require-build
<<: *slack-defaults
- test-machine:
name: LDAP Test
command: bash test/run-docker-ldap-tests.sh
Expand All @@ -687,3 +682,8 @@ workflows:
gradle-task: apiTest
<<: *require-build
<<: *slack-defaults
- test-gradle-functional:
name: New Plugin Blocklist Test
gradle-task: pluginBlocklistTest
<<: *require-build
<<: *slack-defaults
4 changes: 4 additions & 0 deletions docker/official/remco/templates/rundeck-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,8 @@ rundeck.projectService.deferredProjectDelete={{ getv("/rundeck/projectservice/de

{% if exists("/rundeck/scm/startup/initdeferred") %}
rundeck.scm.startup.initDeferred={{ getv("/rundeck/scm/startup/initdeferred") }}
{% endif %}

{% if exists("/rundeck/plugins/providerblocklistfile") %}
rundeck.plugins.providerBlockListFile={{ getv("/rundeck/plugins/providerblocklistfile") }}
{% endif %}
7 changes: 7 additions & 0 deletions functional-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ task apiTest(type: Test){
systemProperty('spock.configuration','spock-configs/IncludeAPITestsConfig.groovy')
description = "Run API tests"
}
task pluginBlocklistTest(type: Test){
useJUnitPlatform()
systemProperty('TEST_IMAGE', "rundeck/rundeck:SNAPSHOT")
systemProperty("COMPOSE_PATH", "docker/compose/oss/docker-compose-blocklist.yml")
systemProperty('spock.configuration','spock-configs/IncludeBlocklistTestsConfig.groovy')
description = "Run Plugin Blocklist tests"
}

task seleniumCoreTest(type: Test){
useJUnitPlatform()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.rundeck.tests.functional.integration

import org.rundeck.util.annotations.BlocklistTest
import org.rundeck.util.container.BaseContainer

@BlocklistTest
class BlocklistSpec extends BaseContainer {


public static final int EXPECTED_PLUGIN_LIST_SIZE = 64
static List<String> BLOCKED_NAMES = [
'cyberark',
'openssh',
'ansible',
'copyfile',
'localexec',
'rundeck-script'
]

def "test blocklist does not contain blocked plugins"() {
when:
List<Map> response = get("/plugin/list", List)
def artifactNames = response*.artifactName.collect { it.toString().toLowerCase() }
then:
verifyAll {
for (String name : BLOCKED_NAMES) {
artifactNames.find { it.contains(name) } == null
}
}
}

def "test expected plugin count"() {
when:
List<Map> response = get("/plugin/list", List)
then:
response.size() == EXPECTED_PLUGIN_LIST_SIZE
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.rundeck.util.annotations

import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target

@Target([ElementType.TYPE, ElementType.METHOD])
@Retention(RetentionPolicy.RUNTIME)
@interface BlocklistTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ providerNameEntries:
- script
- local
WorkflowStep:
- github-script-step
- github-script-step
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3"
services:
rundeck:
image: ${TEST_IMAGE}
environment:
RUNDECK_GRAILS_URL: ${TEST_RUNDECK_GRAILS_URL}
RUNDECK_SERVER_FORWARDED: 'true'
RUNDECK_TOKENS_FILE: /home/rundeck/server/config/tokens.properties
RUNDECK_MULTIURL_ENABLED: "true"
RUNDECK_METRICS_ENABLED: "true"
RUNDECK_PLUGINS_PROVIDERBLOCKLISTFILE: /home/rundeck/blocklist.yaml
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
- "../../../tokens.properties:/home/rundeck/server/config/tokens.properties"
- "../../../realm.properties:/home/rundeck/server/config/realm.properties"
- "../../../blocklist-test/blocklist.yaml:/home/rundeck/blocklist.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import org.rundeck.util.annotations.BlocklistTest

runner {
include BlocklistTest
}
20 changes: 0 additions & 20 deletions test/api/blocklist-missing-plugin-test.sh

This file was deleted.

19 changes: 0 additions & 19 deletions test/api/blocklist-plugin-count-test.sh

This file was deleted.

0 comments on commit 5f9622b

Please sign in to comment.