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

RUN-2317: convert plugin blocklist test #9085

Merged
merged 8 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.