1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
Commit Graph

391 Commits

Author SHA1 Message Date
Marcus Holl
c03a75da9f Ensure script is mandatory parameter
... only in case a step uses the script at all.
2018-10-30 16:24:47 +01:00
Marcus Holl
b8ff2a5285 Merge remote-tracking branch 'github/master' into HEAD 2018-10-09 16:30:55 +02:00
Marcus Holl
b6a205f9aa Merge remote-tracking branch 'github/master' into HEAD 2018-10-09 15:31:43 +02:00
Christopher Fenner
d6f47e802a
executeDockerOnKubernetes: support workspace/container stashing for sidecar case (#330)
* simplify parameter handover

* extract default contaner name and map

* condense pod execution methods

* simplify closure handling

* fix map issue

* simplify

* stash only if needed

* fix test case
2018-10-08 11:54:13 +02:00
Christopher Fenner
34b675a030
handle test repositories (#324)
* handle test repositories

* use GitUtils

* add test case

* fix test cases

* return stash name

* handle seleniumExecuteTests step

* Revert "handle seleniumExecuteTests step"

This reverts commit 2b33d274fe.

* handle seleniumExecuteTests step

* add import of GitUtils
2018-10-08 11:30:42 +02:00
Oliver Nocon
aeb814fc2b
Merge branch 'master' into pr/noExplictGetterAnDSettersInCommonPipelineEnvironment 2018-10-08 09:45:14 +02:00
Oliver Nocon
0ee27774f6
Merge branch 'master' into pr/assertOrderOfGitCommands 2018-10-08 09:43:16 +02:00
Oliver Nocon
7a961ef38e
seleniumExecuteTests - add step to run Selenium tests (#318)
It comes with an extension to executeDocker and executeDockerOnKubernetes to run sidecar containers.

This helps to execute Selenium tests using two Docker images:

1. Execution runtime for tests (e.g. node image)
2. Selenium instance which holds Selenium server + browser

* add documentation & some name cleanup
* include PR feedback
* add step documentation to structure
2018-10-04 17:06:42 +02:00
Marcus Holl
d0d4cac75b Assert that there is no git commit if there should be not commit intentionally (#321)
up to now only the mvn call for setting the version was asserted, but it was not asserted
whether or not there is a commit.
2018-10-02 08:53:21 +02:00
Marcus Holl
252c6da4bd Ensure the order of the git commands
Up to now we checked for git commands, but the order was not taken into account.
Test would pass even if the commit happens before git add.

Now the order of the git commits is asserted.
2018-10-01 13:56:59 +02:00
Marcus Holl
01b03f0df3 [refactoring] Reduce number of sh calls 2018-09-27 16:18:46 +02:00
Marcus Holl
3e556f4afb test asserting setupCPE works with config properties file 2018-09-27 15:46:06 +02:00
Marcus Holl
f14781d913 Report all missing mandatory parameters instead of only the first one 2018-09-27 11:13:47 +02:00
Marcus Holl
752993aefa Merge remote-tracking branch 'github/master' into HEAD 2018-09-27 08:24:04 +02:00
Marcus Holl
726b969682 Merge remote-tracking branch 'github/master' into HEAD 2018-09-21 13:33:42 +02:00
Marcus Holl
9cd31e7236 Merge remote-tracking branch 'github/master' into HEAD 2018-09-21 13:27:29 +02:00
Marcus Holl
f07b596c46 Merge remote-tracking branch 'github/master' into HEAD 2018-09-21 12:48:14 +02:00
Marcus Holl
8a5685bae7 Merge remote-tracking branch 'github/master' into HEAD 2018-09-21 12:18:25 +02:00
Marcus Holl
123ce3a603 Merge remote-tracking branch 'github/master' into HEAD 2018-09-21 11:20:14 +02:00
Marcus Holl
42188d3a4f Merge remote-tracking branch 'github/master' into HEAD 2018-09-21 11:13:07 +02:00
Marcus Holl
726fbe36ab Limit usage of ConfigurationHelper to the builder pattern
it is the duty of the configuration helper to build a map
providing the configuration. Having facilites to use the
ConfigurationHelper as some kind of configuration registry
makes life more complicated.
2018-09-17 12:56:18 +02:00
thorstenwillenbacher
1420c8a5bd
Merge branch 'master' into pr/premoveDeclarationsOfPrepareObjectInterceptors 2018-09-14 10:12:26 +02:00
Marcus Holl
c1900f6ecd Remove output to stdout from tests
In fact nobody reads it, but on some IDEs it is shown when tests are executed.
2018-09-14 09:08:52 +02:00
Marcus Holl
dc9ce9a732 Remove generic gitUtils from BasePiperTest
there is only one test class making use of it left. This test class is the
GitUtilsTest itself.

Hence moving this member downwards in the test class hierarchy into GitUtilsTest.

I doubt it makes sense to make use of a generic git utils mock somewhere else since this basically
means to test the GitUtils class in the conxtext of other examinees. For that there is no need.
The GitUtils class should be tested by the corresponding test class, but not in a transive manner
by other tests. For all other tests a specific git utils mock should be provided mocking the corresponding
method class. This is already the case today, otherwise we would have more test classes making use
of the generic git utils mock.
2018-09-13 16:01:35 +02:00
Marcus Holl
8afec9b4dc Merge remote-tracking branch 'github/master' into HEAD 2018-09-12 11:14:03 +02:00
Marcus Holl
d31e0e73cb Remove not (really) needed declarations of prepareObjectInterceptors
- In ArtifactSetVersionTest the method was declared,
    but not used at all.
  - In MtaUtilsTest there was a particular Object created
    for the sole purpose of serving as script.
    For that we have the nullScript.
  - In DockerArtifactVersioningTest 'this' was configured to
    serve as script. There is basically no reason why the
    instance of the JUnitTest should serve as script.
    Instead we have the nullScript for that purpose.
2018-09-10 16:52:44 +02:00
Sven Merk
61de848114
Merge branch 'master' into pr/removeMockHelper 2018-09-10 14:03:07 +02:00
Marcus Holl
aedfb13a6b Merge remote-tracking branch 'github/master' into HEAD 2018-09-10 13:52:22 +02:00
Marcus Holl
9e378d6b46 Remove obsolete code: mockHelper
in fact the MockHelper seems not to be used anymore. Apparently fully
superseded by our JenkinsRules.
2018-09-10 13:44:42 +02:00
Marcus Holl
c0c0adbeda Prune useless code from MTABuild test. (#288)
should have been removed earlier with the other pull request removing writing the test files.
This is pure leftover.
2018-09-10 13:28:11 +02:00
Marcus Holl
55a952522b ConfigurationHelper: replace all occurences of GString by java.lang.String
GStrings might be handed over e.g. via signature to steps.

GStrings in configuration makes it harder to deal with configurations.
E.g.
   ```if(param == 'a' || param == 'b')``` returns true if a is a GString representing 'a'
but
   ```if(param in ['a', 'b'])``` returns false.

It would be possible not to use the ```in``` notation in our code. But this
increases readability.

GString are not significant and can be replaced by the corresponding java.lang.String
representation without loss of information. Hence it is justified IMO to ensure
there are no GStrings contained in the configuration map.
2018-09-10 10:10:19 +02:00
Marcus Holl
68ab5bacd6 mock GitUtils
if we don't mock the GitUtils here changes inside GitUtils affecting the git commands
issued at the command line requires changes here. In fact we have to react on
implementation details of the GitUtils here. It is better to be independent from that
implementation details here since this leads to more focused and smaller commits.
2018-09-07 16:14:00 +02:00
Marcus Holl
cce1eb0f9a Execute closures when evaluating shell calls
This allows us to e.g. also throw exceptions (e.g. hudson.AbortException) when dealing with
mocked shell calls.
2018-09-07 15:27:55 +02:00
Marcus Holl
b65eca35b2 MapUtils: Provide method for traversing of nested maps. 2018-09-06 12:17:55 +02:00
Christopher Fenner
7b49858233
Merge branch 'master' into pr/artifactSetVersionStreamlineGitHandling 2018-09-05 11:46:11 +02:00
Marcus Holl
12d8f48c38 Do only what is really needed inside the body of sshAgent
- there is no need to do the git commit inside the body of sshAgent
- there is no need to do the git tag inside the body of sshAgent

- side catch: availablility of git user name and git user email is
  checked at its own. If one is missing the other may be present
  ~somehow~ in the configuration.
2018-09-04 17:04:07 +02:00
Florian Wilhelm
50ac5b0ac9
Execute MTA builder in Docker 2018-09-04 11:32:54 +02:00
Marcus Holl
cb3860ffe9 remove not needed closure when registering yaml file 2018-09-04 10:50:03 +02:00
Marcus Holl
138a41f02a Merge remote-tracking branch 'github/master' into work 2018-09-04 10:42:36 +02:00
Marcus Holl
6b7dc48c44 Be more flexible with JenkinsReadYaml rule
When we register a closure as file, the closure will be exectutd.
Otherwise we return what is registered.

This gives us a maximum level of flexibility. We can throw exceptions (e.g. FileNotFound) as
as test setup requires this, in simple cases we provide the yaml as a string.
2018-09-04 09:46:59 +02:00
Marcus Holl
fb425a4c70 Register empty pipeline config yml by default 2018-09-03 15:43:17 +02:00
Marcus Holl
94241f1a6c Register yaml content at beginning of test 2018-09-03 15:43:17 +02:00
Marcus Holl
26ecbe5013 Provide option for registering file for read yaml.
We can now registering files to JenkinsReadYamlRule by
providing the file name alongside with the expected content
(or e.g. an expception)

With that change it is possible to remove pwd statements
from mtaBuild. These statements was used in order to pass
a temporary directory inside the mtaBuild (code under test).
This is not needed anymore since we can register the files
directly.

Having pwd implies working with absolute pathes which is
also a no-go when working with docker, since the absolute
pathes inside and outside docker are normally not the same.

For pathes relative to a build root directory it is rather
easy to keep the pathes consistent the same.

Adjust sources according to registering yaml file to jenkins rule.

For mtaBuild this means also: get ride of absolute pathes for denoting the yaml file.
Having absolute pathes makes it difficult/impossible to work also with dockerized versions
of mtaBuild since the absolute pathes are most probably not the same inside and outside
the docker container, but the relatives pathes can be kept the same easily.
2018-09-03 15:43:15 +02:00
Marcus Holl
5cca5fddbb Tests: make use of JenkinsCredentialsRule
JenkinsCredentialsRule now closer to reality since it mimics
the bevavior or the credentials plugin in case a credential
is not known.
2018-09-03 12:28:08 +02:00
Marcus Holl
c54b6e6cf2 Make DefaultConfigurationCache instance checks more precise
up to now we check some values provided by the DefaultConfigurationCache. This is some kind
of plausibility check, but this is not really a check that the instance did not change.

With the tests as they are now we check in fact for a new instance.
2018-09-03 09:38:41 +02:00
Marcus Holl
b6fd507145 Be more precise with libraryResource and read yaml in prepareDefaultValuesTest
In the free wild it is the duty of libraryResource to provide some resource as text
and it is the duty of readYaml to parse a text (... would also be possible to read
a file instead just parsing text, but that is a different story).

In our setup we just forwarded the resource name in libraryResource and reacted on
that resource name inside read yaml. There was no yaml parsing at all, the yaml 'as
it' was returned.

The approach now is much closer to reality. Library resource now provides the
text 'behind' the resource and yaml parses it. There is now a real yaml parsing.
Read yaml is now not registered explicitly anymore. It is just the readYaml closure
which is registerd by default for our tests.
2018-09-03 09:24:57 +02:00
Marcus Holl
f2feb8f5ad Ensure consistent location for files used by versioning tests (#278) 2018-08-31 14:13:11 +02:00
Marcus Holl
8a019f5b86 Remove read yaml rule from common rules
read yaml rule is a very frequently used rule. But having the rule in the common rules
means we cannot register text or files to that rule, which makes it less handy to work
with yaml files in the tests.
2018-08-31 10:22:46 +02:00
Christopher Fenner
4425629ee7
notify about deactivated SWA reporting (#261)
* report deactivated SWA reporting

* Update Utils.groovy

* add tests

* add test cases

* use hamcrest matchers in tests

* check for missing call to web analytics

* Update UtilsTest.groovy
2018-08-29 10:01:16 +02:00
Roland Stengel
67429626a7 cmclient call needs to quote the file path 2018-08-28 15:29:08 +02:00