mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
Add warning
This commit is contained in:
parent
43cb2c68cf
commit
3d81e09ab3
@ -38,6 +38,8 @@ class WhitesourceConfigurationHelper implements Serializable {
|
||||
[name: 'ignoreSourceFiles', value: true, force: true],
|
||||
[name: 'resolveAllDependencies', value: false, force: true]
|
||||
]
|
||||
if(!['pip', 'golang'].contains(config.scanType))
|
||||
script.echo "[Whitesource] Configuration for scanType: '${config.scanType}' is not yet hardened, please do a quality assessment of your scan results."
|
||||
switch (config.scanType) {
|
||||
case 'npm':
|
||||
mapping += [
|
||||
|
@ -5,23 +5,27 @@ import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.RuleChain
|
||||
import util.BasePiperTest
|
||||
import util.JenkinsLoggingRule
|
||||
import util.JenkinsReadFileRule
|
||||
import util.JenkinsWriteFileRule
|
||||
import util.Rules
|
||||
|
||||
import static org.hamcrest.Matchers.containsString
|
||||
import static org.hamcrest.Matchers.hasItem
|
||||
import static org.hamcrest.Matchers.not
|
||||
import static org.junit.Assert.assertThat
|
||||
|
||||
class WhiteSourceConfigurationHelperTest extends BasePiperTest {
|
||||
JenkinsReadFileRule jrfr = new JenkinsReadFileRule(this, 'test/resources/utilsTest/')
|
||||
JenkinsWriteFileRule jwfr = new JenkinsWriteFileRule(this)
|
||||
JenkinsLoggingRule jlr = new JenkinsLoggingRule(this)
|
||||
|
||||
@Rule
|
||||
public RuleChain ruleChain = Rules
|
||||
.getCommonRules(this)
|
||||
.around(jrfr)
|
||||
.around(jwfr)
|
||||
.around(jlr)
|
||||
|
||||
@Before
|
||||
void init() {
|
||||
@ -35,6 +39,8 @@ class WhiteSourceConfigurationHelperTest extends BasePiperTest {
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productName=DIST - name1"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productToken=1234"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("userKey=0000"))
|
||||
|
||||
assertThat(jlr.log, containsString("[Whitesource] Configuration for scanType: 'none' is not yet hardened, please do a quality assessment of your scan results."))
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -44,6 +50,8 @@ class WhiteSourceConfigurationHelperTest extends BasePiperTest {
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productName=DIST - name1"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productToken=1234"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("userKey=0000"))
|
||||
|
||||
assertThat(jlr.log, containsString("[Whitesource] Configuration for scanType: 'npm' is not yet hardened, please do a quality assessment of your scan results."))
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -53,6 +61,9 @@ class WhiteSourceConfigurationHelperTest extends BasePiperTest {
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productName=DIST - name1"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productToken=1234"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("userKey=0000"))
|
||||
|
||||
assertThat(jlr.log, containsString("[Whitesource] Configuration for scanType: 'sbt' is not yet hardened, please do a quality assessment of your scan results."))
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -62,6 +73,8 @@ class WhiteSourceConfigurationHelperTest extends BasePiperTest {
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productName=DIST - name1"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productToken=1234"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("userKey=0000"))
|
||||
|
||||
assertThat(jlr.log, containsString("[Whitesource] Configuration for scanType: 'dlang' is not yet hardened, please do a quality assessment of your scan results."))
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -72,6 +85,8 @@ class WhiteSourceConfigurationHelperTest extends BasePiperTest {
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("productToken=1234"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("userKey=0000"))
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("python.resolveDependencies=true"))
|
||||
|
||||
assertThat(jlr.log, not(containsString("[Whitesource] Configuration for scanType: 'pip' is not yet hardened, please do a quality assessment of your scan results.")))
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -86,6 +101,7 @@ class WhiteSourceConfigurationHelperTest extends BasePiperTest {
|
||||
assertThat(jwfr.files['./config.847f9aec2f93de9000d5fa4e6eaace2283ae6377'], containsString("log.level=debug"))
|
||||
|
||||
assertThat(config.stashContent, hasItem(containsString('modified whitesource config ')))
|
||||
assertThat(jlr.log, not(containsString("[Warning][Whitesource] Configuration for scanType: 'golang' is not yet hardened, please do a quality assessment of your scan results.")))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user