Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from dukecon/feature/#1-configuration
Browse files Browse the repository at this point in the history
Feature/#1 configuration
  • Loading branch information
srose authored Jun 10, 2020
2 parents f5fb359 + dd48273 commit 3b9c804
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
53 changes: 53 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env groovy
@Library('jenkins-library@master') _

pipeline {
agent {
node {
label 'docker'
}
}

options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '5', daysToKeepStr: '5'))
}

parameters {
choice(
name: "testTarget",
choices: "latest\ntesting",
description: "Set the DukeCon target environment for testing"
)
}

triggers {
pollSCM('*/3 * * * *')
}

stages {
stage('API Test') {
steps {
sh "mvn ${mvnProfile(params.testTarget)} clean test"
}
}
}
post {
always {
sendNotification currentBuild.result
}
failure {
// notify users when the Pipeline fails
mail to: '[email protected]',
subject: "Failed DukeCon API Test Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}
}

def mvnProfile(testTarget) {
if ("latest" != testTarget) {
return "-P ${testTarget}"
}
return ""
}
20 changes: 18 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>

<dukecon.apitests.baseurl>https://latest.dukecon.org/javaland/2019</dukecon.apitests.baseurl>
</properties>

<dependencies>
Expand Down Expand Up @@ -52,6 +54,11 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<systemPropertyVariables>
<dukecon.apitests.baseurl>${dukecon.apitests.baseurl}</dukecon.apitests.baseurl>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand All @@ -77,4 +84,13 @@
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>testing</id>
<properties>
<dukecon.apitests.baseurl>https://testing.dukecon.org/javaland/2019</dukecon.apitests.baseurl>
</properties>
</profile>
</profiles>
</project>
7 changes: 6 additions & 1 deletion src/test/java/org/dukecon/WebResourcesTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@

public class WebResourcesTests {

private static String baseUrl
= System.getProperty("dukecon.apitests.baseurl",
"https://latest.dukecon.org/javaland/2019");

@BeforeEach
public void setup() {
RestAssured.baseURI = "https://latest.dukecon.org/javaland/2019";
System.out.println ("Testing '" + baseUrl + "'");
RestAssured.baseURI = baseUrl;
RestAssured.port = 443;
RestAssured.registerParser("text/css", Parser.TEXT);
}
Expand Down

0 comments on commit 3b9c804

Please sign in to comment.