-
Notifications
You must be signed in to change notification settings - Fork 3
add unit test to unitTest.groovy #500
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
Open
osalyk
wants to merge
19
commits into
master
Choose a base branch
from
osalyk/pipline-lib_tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
07806e1
add unit test to unitTest.groovy
osalyk 01441cf
add stage to Jenkinsfile
osalyk b41cef2
fix Jenkinsfile
osalyk e559e51
create gradle.properties file
osalyk 0c26d19
use env DAOS_HTTPS_PROXY
osalyk 20bf3fe
install jdk
osalyk 8be5fc0
use brd-108
osalyk 9791f3f
fix changes following the code review
osalyk 802ce85
add gradle-wrappe.jar file
osalyk 2db7631
add fixes to the PR
osalyk 2a16ea8
fix the styling
osalyk 15bea8e
rename the agent
osalyk 44d31e3
Remove all def
osalyk 40b0471
fix the proxy settings
osalyk 4c1253e
Merge remote-tracking branch 'origin/master' into osalyk/pipline-lib_…
osalyk 42d3833
Use local artifactory for the gradlew package
osalyk 4a97421
Make the gradle-init file executable
osalyk 1f86757
Correct the typo
osalyk 44ea11d
Improve README.md file
osalyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .gradle | ||
| build | ||
| gradle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -190,3 +190,25 @@ upload to validate. | |||||
|
|
||||||
| The publishToRepositorySystem step should download the artifacts back to | ||||||
| this directory and fail the step if the contents differ. | ||||||
|
|
||||||
| ## Unit tests | ||||||
|
|
||||||
| Requirements: | ||||||
|
|
||||||
| - JDK | ||||||
|
|
||||||
| ### How to run unit tests | ||||||
|
|
||||||
| From the main directory, run: | ||||||
|
|
||||||
| ```bash | ||||||
| gradlew test | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ``` | ||||||
|
|
||||||
| ## Formatting | ||||||
|
|
||||||
| **Note**: Not all Groovy files are covered yet. You are very welcome to include more though. Please see (build.gradle)[build.gradle]. | ||||||
|
|
||||||
| ```sh | ||||||
| gradlew spotlessApply | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ``` | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright 2026 Hewlett Packard Enterprise Development LP | ||
| * | ||
| * SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'groovy' | ||
| id 'com.diffplug.spotless' version 'latest.release' | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation localGroovy() | ||
| testImplementation localGroovy() | ||
| testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' | ||
| testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.0' | ||
| } | ||
|
|
||
| spotless { | ||
| groovy { | ||
| target 'src/test/**/*.groovy' | ||
| importOrder() | ||
| endWithNewline() | ||
| greclipse().configFile(rootProject.file('greclipse.properties')) | ||
| } | ||
| groovyGradle { | ||
| target '*.gradle' | ||
| endWithNewline() | ||
| greclipse().configFile(rootProject.file('greclipse.properties')) | ||
| } | ||
| } | ||
|
|
||
| test { | ||
| useJUnitPlatform() | ||
| testLogging { | ||
| events 'passed', 'skipped', 'failed', 'started' | ||
| exceptionFormat = 'full' | ||
| showStandardStreams = true | ||
| } | ||
| outputs.upToDateWhen { false } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Copyright 2026, Hewlett Packard Enterprise Development LP | ||
| # | ||
| # SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| # | ||
| set -euo pipefail | ||
|
|
||
| DIST_FILE='gradle-9.0-bin.zip' | ||
| DIST_URL="https://artifactory.daos.hpc.amslabs.hpecorp.net/artifactory/gradle-services-proxy/distributions/$DIST_FILE" | ||
| DIST_DIR='gradle-9.0.0' # it must match the name of the directory stored inside the ZIP | ||
|
|
||
| GRADLE_USER_HOME='.gradle' | ||
|
|
||
| mkdir -p "$GRADLE_USER_HOME" | ||
|
|
||
| DIR="$GRADLE_USER_HOME/$DIST_DIR" | ||
| BIN="$DIR/bin/gradle" | ||
| if [ -f "$BIN" ]; then | ||
| echo "WARN: '$BIN' is already there." | ||
| echo | ||
| echo "Remove '$DIR' if you want to download it again." | ||
| else | ||
| # download and unzip | ||
| cd "$GRADLE_USER_HOME" | ||
| wget "$DIST_URL" | ||
| unzip "$DIST_FILE" | ||
| rm "$DIST_FILE" | ||
| cd - | ||
|
|
||
| if [ ! -f "$BIN" ]; then | ||
| echo "ERROR: There is no '$BIN' file in '$DIST_URL'." | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| SYM=gradle | ||
| rm -f $SYM | ||
| ln -s "$BIN" $SYM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #Whether to use 'space', 'tab' or 'mixed' (both) characters for indentation. | ||
| #The default value is 'tab'. | ||
| org.eclipse.jdt.core.formatter.tabulation.char=space | ||
|
|
||
| #Number of spaces used for indentation in case 'space' characters | ||
| #have been selected. The default value is 4. | ||
| org.eclipse.jdt.core.formatter.tabulation.size=4 | ||
|
|
||
| #Number of spaces used for indentation in case 'mixed' characters | ||
| #have been selected. The default value is 4. | ||
| org.eclipse.jdt.core.formatter.indentation.size=4 | ||
|
|
||
| #Whether or not indentation characters are inserted into empty lines. | ||
| #The default value is 'true'. | ||
| org.eclipse.jdt.core.formatter.indent_empty_lines=false | ||
|
|
||
| #Number of spaces used for multiline indentation. | ||
| #The default value is 2. | ||
| groovy.formatter.multiline.indentation=1 | ||
|
|
||
| #Length after which list are considered too long. These will be wrapped. | ||
| #The default value is 30. | ||
| groovy.formatter.longListLength=30 | ||
|
|
||
| #Whether opening braces position shall be the next line. | ||
| #The default value is 'same'. | ||
| groovy.formatter.braces.start=same | ||
|
|
||
| #Whether closing braces position shall be the next line. | ||
| #The default value is 'next'. | ||
| groovy.formatter.braces.end=next | ||
|
|
||
| #Remove unnecessary semicolons. The default value is 'false'. | ||
| groovy.formatter.remove.unnecessary.semicolons=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* | ||
| * (C) Copyright 2026 Hewlett Packard Enterprise Development LP | ||
| * | ||
| * SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| */ | ||
|
|
||
| package helpers | ||
|
|
||
| class Asserts { | ||
|
|
||
| static void assertIsSubset(Map subset, Map set) { | ||
| assert subset.every { k, v -> set[k] == v } : subset + ' is not a subset of ' + set | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * (C) Copyright 2026 Hewlett Packard Enterprise Development LP | ||
| * | ||
| * SPDX-License-Identifier: BSD-2-Clause-Patent | ||
| */ | ||
|
|
||
| package helpers | ||
|
|
||
| import groovy.lang.Binding | ||
|
|
||
| class Bindings { | ||
|
|
||
| static void commonBindings(Binding binding) { | ||
| binding.setVariable('sh', { Map m -> | ||
| if (m.returnStdout) { | ||
| return '' | ||
| } | ||
| return 0 | ||
| }) | ||
|
|
||
| binding.setVariable('timeout', { Map m, Closure c -> | ||
| c() | ||
| }) | ||
|
|
||
| binding.setVariable('stash', { Map m -> }) | ||
| binding.setVariable('writeYaml', { Map m -> }) | ||
| binding.setVariable('httpRequest', { Map m -> }) | ||
| binding.setVariable('fileOperations', { List l -> }) | ||
| binding.setVariable('fileCopyOperation', { Map m -> [:] }) | ||
| binding.setVariable('catchError', { Map m, Closure c -> c() }) | ||
| binding.setVariable('error', { String s -> }) | ||
| binding.setVariable('echo', { String s -> }) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.