Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/it/apache-release-profile/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
# specific language governing permissions and limitations
# under the License.

# Test with apache-release profile activated
invoker.goals = deploy -Papache-release
# Test with apache-release profile
invoker.goals.1 = release:clean release:prepare
invoker.goals.2 = release:perform
7 changes: 7 additions & 0 deletions src/it/apache-release-profile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.deploy.skip>true</maven.deploy.skip>
<gpg.skip>true</gpg.skip>
<!-- don't push changes to remote SCM repository during release preparation -->
<pushChanges>false</pushChanges>
</properties>

<scm>
<!-- use local file-based SCM for testing purpose -->
<developerConnection>scm:git:file://${project.basedir}</developerConnection>
</scm>

<build>
<pluginManagement>
<plugins>
Expand Down
32 changes: 32 additions & 0 deletions src/it/apache-release-profile/selector.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

// check if git executable exist
def proc = ["git", "--version"].execute()
proc.waitFor()

println "return code: ${proc.exitValue()}"
println "stdout: ${proc.in.text}"
println "stderr: ${proc.err.text}"

if (proc.exitValue() == 0) {
return true
}

return false
38 changes: 38 additions & 0 deletions src/it/apache-release-profile/setup.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

def execute(def cmd) {
println "execute: ${cmd}"
def proc = cmd.execute(null, basedir)
proc.waitFor()
println "return code: ${proc.exitValue()}"
println "stderr: ${proc.err.text}"
println "stdout: ${proc.in.text}"
if (proc.exitValue() != 0) {
throw new RuntimeException("Command failed: ${cmd}\nstdout: ${proc.in.text}\nstderr: ${proc.err.text}")
}
}

// setup local git repository
execute(["git", "init"])
execute(["git", "config", "user.email", "test@example.com"])
execute(["git", "config", "user.name", "Test User"])
execute(["git", "add", "pom.xml", "src"])
execute(["git", "commit", "-m", "initial commit"])

37 changes: 37 additions & 0 deletions src/it/apache-release-profile/verify.1.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

// verification after first goal - release:perform was only executed

def buildLog = new File(basedir, 'build.log')
assert buildLog.exists()

// release preparation finished
assert buildLog.text.contains('prepare:run-preparation-goals') :
'Expected message not found in build log'

assert !buildLog.text.contains('perform:run-perform-goals') :
'Release perform should not be performed during release preparation'

// there are no interactions with ATR client during release preparation,
// as the profile apache-release is not active
assert !buildLog.text.contains('[Mock ATR client]') :
'Should be no interaction with ATR client during release preparation'


20 changes: 14 additions & 6 deletions src/it/apache-release-profile/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,29 @@
def buildLog = new File(basedir, 'build.log')
assert buildLog.exists()

assert buildLog.text.count('[INFO] [Mock ATR client] creating new JWT for username: dummy-asfuid') == 1
// in final log we have both goal executed - prepare and perform
assert buildLog.text.contains('prepare:run-preparation-goals') :
'Expected message not found in build log'

assert buildLog.text.count('[INFO] [Mock ATR client] using cached JWT: mock-jwt-dummy-asfuid') == 1
assert buildLog.text.contains('perform:run-perform-goals') :
'Expected message not found in build log'

assert buildLog.text.count('[INFO] [Mock ATR client] created base URL: https://release-test.apache.org/, username: dummy-asfuid, password: dummy-token') == 2:
// interaction with ATR client should be visible after perform goal execution
assert buildLog.text.count('[INFO] [INFO] [Mock ATR client] creating new JWT for username: dummy-asfuid') == 1 :
'Expected message not found in build log'

assert buildLog.text.count('[INFO] [Mock ATR client] getRelease: tooling-atr-test-apache-release, 1.0-SNAPSHOT') == 1 :
assert buildLog.text.count('[INFO] [INFO] [Mock ATR client] using cached JWT: mock-jwt-dummy-asfuid') == 1 :
'Expected message not found in build log'

assert buildLog.text.count('[INFO] [Mock ATR client] uploadFile: tooling-atr-test-apache-release, 1.0-SNAPSHOT, tooling-atr-test-apache-release-1.0-SNAPSHOT-source-release.zip, ') == 1 :
assert buildLog.text.count('[INFO] [INFO] [Mock ATR client] created base URL: https://release-test.apache.org/, username: dummy-asfuid, password: dummy-token') == 2 :
'Expected message not found in build log'

assert buildLog.text.count('[INFO] [Mock ATR client] uploadFile: tooling-atr-test-apache-release, 1.0-SNAPSHOT, tooling-atr-test-apache-release-1.0-SNAPSHOT-source-release.zip.sha512, ') == 1 :
assert buildLog.text.count('[INFO] [INFO] [Mock ATR client] getRelease: tooling-atr-test-apache-release, 1.0') == 1 :
'Expected message not found in build log'

assert buildLog.text.count('[INFO] [INFO] [Mock ATR client] uploadFile: tooling-atr-test-apache-release, 1.0, tooling-atr-test-apache-release-1.0-source-release.zip, ') == 1 :
'Expected message not found in build log'

assert buildLog.text.count('[INFO] [INFO] [Mock ATR client] uploadFile: tooling-atr-test-apache-release, 1.0, tooling-atr-test-apache-release-1.0-source-release.zip.sha512, ') == 1 :
'Expected message not found in build log'