Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into propaganda-0
Browse files Browse the repository at this point in the history
  • Loading branch information
smatthewenglish committed Feb 14, 2019
2 parents e3d12b6 + d410ac9 commit fad7fb3
Show file tree
Hide file tree
Showing 367 changed files with 11,881 additions and 4,031 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ We have a set of [coding conventions](CODING-CONVENTIONS.md) to which we try to
[search-label-enhancement]: https://github.com/search?q=is%3Aopen+is%3Aissue+repo%3APegasysEng%2FPantheon+label%3Aenhancement
[search-label-bug]: https://github.com/search?q=is%3Aopen+is%3Aissue+repo%3APegasysEng%2FPantheon+label%3Abug
[search-label-help-wanted]: https://github.com/search?q=is%3Aopen+is%3Aissue+repo%3APegasysEng%2FPantheon+label%3Ahelp%20wanted
[search-label-good-first-issue]: https://github.com/search?q=is%3Aopen+is%3Aissue+repo%3APegasysEng%2FPantheon+label%3Agood%20first%20issue
[search-label-good-first-issue]: https://github.com/PegasysEng/pantheon/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
[search-label-info-needed]: https://github.com/search?q=is%3Aopen+is%3Aissue+repo%3APegasysEng%2FPantheon+label%3Ainfo%20needed
[search-label-needs-reproduction]: https://github.com/search?q=is%3Aopen+is%3Aissue+repo%3APegasysEng%2FPantheon+label%3Aneeds%20reproduction
[search-label-blocked]: https://github.com/search?q=is%3Aopen+is%3Aissue+repo%3APegasysEng%2FPantheon+label%3Ablocked
Expand Down
160 changes: 122 additions & 38 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env groovy

import hudson.model.Result
import hudson.model.Run
import jenkins.model.CauseOfInterruption.UserInterruption

if (env.BRANCH_NAME == "master") {
properties([
buildDiscarder(
Expand All @@ -18,49 +22,129 @@ if (env.BRANCH_NAME == "master") {
])
}

def docker_image = 'docker:18.06.0-ce-dind'
def build_image = 'pegasyseng/pantheon-build:0.0.5-jdk11'

def abortPreviousBuilds() {
Run previousBuild = currentBuild.rawBuild.getPreviousBuildInProgress()

while (previousBuild != null) {
if (previousBuild.isInProgress()) {
def executor = previousBuild.getExecutor()
if (executor != null) {
echo ">> Aborting older build #${previousBuild.number}"
executor.interrupt(Result.ABORTED, new UserInterruption(
"Aborted by newer build #${currentBuild.number}"
))
}
}

previousBuild = previousBuild.getPreviousBuildInProgress()
}
}

abortPreviousBuilds()

try {
node {
checkout scm
docker.image('docker:18.06.0-ce-dind').withRun('--privileged') { d ->
docker.image('pegasyseng/pantheon-build:0.0.5-jdk11').inside("--link ${d.id}:docker") {
try {
stage('Compile') {
sh './gradlew --no-daemon --parallel clean compileJava'
}
stage('compile tests') {
sh './gradlew --no-daemon --parallel compileTestJava'
}
stage('assemble') {
sh './gradlew --no-daemon --parallel assemble'
}
stage('Build') {
sh './gradlew --no-daemon --parallel build'
}
stage('Reference tests') {
sh './gradlew --no-daemon --parallel referenceTest'
}
stage('Integration Tests') {
sh './gradlew --no-daemon --parallel integrationTest'
}
stage('Acceptance Tests') {
sh './gradlew --no-daemon --parallel acceptanceTest'
}
stage('Check Licenses') {
sh './gradlew --no-daemon --parallel checkLicenses'
parallel UnitTests: {
def stage_name = "Unit tests node: "
node {
checkout scm
docker.image(docker_image).withRun('--privileged') { d ->
docker.image(build_image).inside("--link ${d.id}:docker") {
try {
stage(stage_name + 'Prepare') {
sh './gradlew --no-daemon --parallel clean compileJava compileTestJava assemble'
}
stage(stage_name + 'Unit tests') {
sh './gradlew --no-daemon --parallel build'
}
} finally {
archiveArtifacts '**/build/reports/**'
archiveArtifacts '**/build/test-results/**'
archiveArtifacts 'build/reports/**'
archiveArtifacts 'build/distributions/**'

junit '**/build/test-results/**/*.xml'
}
stage('Check javadoc') {
sh './gradlew --no-daemon --parallel javadoc'
}
}
}
}, ReferenceTests: {
def stage_name = "Reference tests node: "
node {
checkout scm
docker.image(docker_image).withRun('--privileged') { d ->
docker.image(build_image).inside("--link ${d.id}:docker") {
try {
stage(stage_name + 'Prepare') {
sh './gradlew --no-daemon --parallel clean compileJava compileTestJava assemble'
}
stage(stage_name + 'Reference tests') {
sh './gradlew --no-daemon --parallel referenceTest'
}
} finally {
archiveArtifacts '**/build/reports/**'
archiveArtifacts '**/build/test-results/**'
archiveArtifacts 'build/reports/**'
archiveArtifacts 'build/distributions/**'

junit '**/build/test-results/**/*.xml'
}
stage('Jacoco root report') {
sh './gradlew --no-daemon jacocoRootReport'
}
}
}
}, IntegrationTests: {
def stage_name = "Integration tests node: "
node {
checkout scm
docker.image(docker_image).withRun('--privileged') { d ->
docker.image(build_image).inside("--link ${d.id}:docker") {
try {
stage(stage_name + 'Prepare') {
sh './gradlew --no-daemon --parallel clean compileJava compileTestJava assemble'
}
stage(stage_name + 'Integration Tests') {
sh './gradlew --no-daemon --parallel integrationTest'
}
stage(stage_name + 'Check Licenses') {
sh './gradlew --no-daemon --parallel checkLicenses'
}
stage(stage_name + 'Check javadoc') {
sh './gradlew --no-daemon --parallel javadoc'
}
} finally {
archiveArtifacts '**/build/reports/**'
archiveArtifacts '**/build/test-results/**'
archiveArtifacts 'build/reports/**'
archiveArtifacts 'build/distributions/**'

junit '**/build/test-results/**/*.xml'
}
} finally {
archiveArtifacts '**/build/reports/**'
archiveArtifacts '**/build/test-results/**'
archiveArtifacts 'build/reports/**'
archiveArtifacts 'build/distributions/**'
}
}
}
}, AcceptanceTests: {
def stage_name = "Acceptance tests node: "
node {
checkout scm
docker.image(docker_image).withRun('--privileged') { d ->
docker.image(build_image).inside("--link ${d.id}:docker") {
try {
stage(stage_name + 'Prepare') {
sh './gradlew --no-daemon --parallel clean compileJava compileTestJava assemble'
}
stage(stage_name + 'Acceptance Tests') {
sh './gradlew --no-daemon --parallel acceptanceTest'
}
} finally {
archiveArtifacts '**/build/reports/**'
archiveArtifacts '**/build/test-results/**'
archiveArtifacts 'build/reports/**'
archiveArtifacts 'build/distributions/**'

junit '**/build/test-results/**/*.xml'
junit '**/build/test-results/**/*.xml'
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Clique;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eth;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Ibft;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Login;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Net;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Perm;
import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Web3;
Expand Down Expand Up @@ -46,6 +47,7 @@ public class AcceptanceTestBase {
protected final Ibft ibft;
protected final Web3 web3;
protected final Eth eth;
protected final Login login;
protected final Net net;
protected final Perm perm;
protected final Admin admin;
Expand All @@ -63,6 +65,7 @@ protected AcceptanceTestBase() {

clique = new Clique(ethTransactions, cliqueTransactions);
ibft = new Ibft(ibftTransactions);
login = new Login();
net = new Net(new NetTransactions());
cluster = new Cluster(net);
transactions = new Transactions(accounts);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2018 ConsenSys AG.
*
* Licensed 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.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.condition.login;

import static org.assertj.core.api.Assertions.assertThat;

import tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.httptransaction.LoginResponds;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;

public class AwaitLoginResponse implements Condition {

private final LoginResponds transaction;

public AwaitLoginResponse(final LoginResponds transaction) {
this.transaction = transaction;
}

@Override
public void verify(final Node node) {
WaitUtils.waitFor(() -> assertThat(node.executeHttpTransaction(transaction)).isNotNull());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2018 ConsenSys AG.
*
* Licensed 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.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.condition.net;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;

import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.net.NetVersionTransaction;

import org.web3j.protocol.exceptions.ClientConnectionException;

public class ExpectNetVersionPermissionException implements Condition {

private final NetVersionTransaction transaction;
private final String expectedMessage;

public ExpectNetVersionPermissionException(
final NetVersionTransaction transaction, final String expectedMessage) {
this.transaction = transaction;
this.expectedMessage = expectedMessage;
}

@Override
public void verify(final Node node) {
final Throwable thrown = catchThrowable(() -> node.execute(transaction));
assertThat(thrown).isInstanceOf(RuntimeException.class);

final Throwable cause = thrown.getCause();
assertThat(cause).isInstanceOf(ClientConnectionException.class);
assertThat(cause.getMessage()).contains(expectedMessage);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2019 ConsenSys AG.
*
* Licensed 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.
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm;

import static org.assertj.core.api.Assertions.assertThat;

import tech.pegasys.pantheon.ethereum.permissioning.WhitelistPersistor;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;

import java.nio.file.Path;
import java.util.Collection;

public class WhiteListContainsKeyAndValue implements Condition {
private final WhitelistPersistor.WHITELIST_TYPE whitelistType;
private final Collection<String> whitelistValues;
private final Path configFilePath;

public WhiteListContainsKeyAndValue(
final WhitelistPersistor.WHITELIST_TYPE whitelistType,
final Collection<String> whitelistValues,
final Path configFilePath) {
this.whitelistType = whitelistType;
this.whitelistValues = whitelistValues;
this.configFilePath = configFilePath;
}

@Override
public void verify(final Node node) {
boolean result;
try {
result =
WhitelistPersistor.verifyConfigFileMatchesState(
whitelistType, whitelistValues, configFilePath);
} catch (final Exception e) {
result = false;
}
assertThat(result).isTrue();
}
}
Loading

0 comments on commit fad7fb3

Please sign in to comment.