-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3274 from ethereum/ci/e2e-mosaic
Add E2E Mosaic test
- Loading branch information
Showing
8 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,56 @@ | ||
# ------------------------------------------------------------------------------------------- | ||
# Run mosaicdao/mosaic-1 fork (w/ buidler truffle5 plugin) using a candidate | ||
# branch of web3 which has been published to a proxy npm registry in `e2e.npm.publish.sh` | ||
# | ||
# This test's purpose is to watch web3 execute a long, complex test suite | ||
# It uses buidler-adapted fork of mosaicdao because that tool is simpler and | ||
# more modular than Truffle and lets us resolve arbitrary versions of web3 more easily. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
# Exit immediately on error | ||
set -o errexit | ||
|
||
# To mimic `npm install web3` correctly, this test does not install Web3's dev deps. | ||
# However, we need the npm package `semver` to coerce yarn resolutions correctly. | ||
# It must be installed as a dev dep or Node complains. We also need web3's package.json | ||
# to resolve the current version + patch increment. So some file renaming is necessary here... | ||
cp package.json original.package.json | ||
rm package.json | ||
rm package-lock.json | ||
npm init --yes | ||
npm install --save-dev semver | ||
|
||
# Install mosaic and set yarn resolutions to virtually published patch version | ||
git clone https://github.com/cgewecke/mosaic-1.git | ||
scripts/js/resolutions.js mosaic-1 | ||
cd mosaic-1 | ||
|
||
# Install via registry and verify | ||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" | ||
echo "Installing updated web3 via virtual registry " | ||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" | ||
|
||
git submodule update --init --recursive | ||
yarn --registry http://localhost:4873 | ||
|
||
yarn add web3@e2e --registry http://localhost:4873 | ||
|
||
yarn list web3 | ||
yarn list web3-utils | ||
yarn list web3-core | ||
yarn list web3-core-promievent | ||
|
||
cat ./package.json | ||
|
||
# Test | ||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" | ||
echo "Running mosaicdao/mosaic-1 unit tests. " | ||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" | ||
|
||
# Launch ganache | ||
./tools/run_ganache_cli.sh </dev/null 1>/dev/null 2>&1 & | ||
sleep 10 | ||
|
||
# Compile and test | ||
npx buidler compile | ||
npm test |
This file contains 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 |
---|---|---|
|
@@ -23,7 +23,6 @@ fi | |
# what it needs here. | ||
npm install -g [email protected] | ||
npm install -g [email protected] | ||
npm install -g [email protected] | ||
npm install -g [email protected] | ||
|
||
# Launch npm proxy registry | ||
|
This file contains 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 |
---|---|---|
|
@@ -8,6 +8,9 @@ | |
# Exit immediately on error | ||
set -o errexit | ||
|
||
# Install test specific dependencies | ||
npm install -g [email protected] | ||
|
||
# Launch geth | ||
npm run geth | ||
|
||
|
This file contains 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,59 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* This script is a helper for running a buidler based e2e unit test target and is | ||
* used in combination with the npm virtual publishing script. | ||
* | ||
* It discovers the current web3 package version, gets its patch increment | ||
* (also the value of the virtually published version) and attaches a yarn resolutions field | ||
* to the target's package.json to coerce any Web3 packages up to the patch when target is | ||
* installed. | ||
* | ||
* USAGE: resolutions.js <target-folder-name> | ||
* EXAMPLE: node scripts/js/resolutions.js mosaic-1 | ||
* | ||
*/ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const semver = require('semver'); | ||
const web3PackagePath = path.join(process.cwd(), 'original.package.json'); | ||
const targetPackagePath = path.join(process.cwd(), process.argv[2], 'package.json'); | ||
|
||
const web3Package = require(web3PackagePath); | ||
const targetPackage = require(targetPackagePath); | ||
|
||
const patch = semver.inc(web3Package.version, 'patch'); | ||
|
||
targetPackage.resolutions = { | ||
"@nomiclabs/**/web3": `${patch}`, | ||
"@nomiclabs/**/web3-bzz": `${patch}`, | ||
"@nomiclabs/**/web3-core-helpers": `${patch}`, | ||
"@nomiclabs/**/web3-core-method": `${patch}`, | ||
"@nomiclabs/**/web3-core-promievent": `${patch}`, | ||
"@nomiclabs/**/web3-core-requestmanager": `${patch}`, | ||
"@nomiclabs/**/web3-core-subscriptions": `${patch}`, | ||
"@nomiclabs/**/web3-core": `${patch}`, | ||
"@nomiclabs/**/web3-eth-abi": `${patch}`, | ||
"@nomiclabs/**/web3-eth-accounts": `${patch}`, | ||
"@nomiclabs/**/web3-eth-contract": `${patch}`, | ||
"@nomiclabs/**/web3-eth-ens": `${patch}`, | ||
"@nomiclabs/**/web3-eth-iban": `${patch}`, | ||
"@nomiclabs/**/web3-eth-personal": `${patch}`, | ||
"@nomiclabs/**/web3-eth": `${patch}`, | ||
"@nomiclabs/**/web3-net": `${patch}`, | ||
"@nomiclabs/**/web3-providers-http": `${patch}`, | ||
"@nomiclabs/**/web3-providers-ipc": `${patch}`, | ||
"@nomiclabs/**/web3-providers-ws": `${patch}`, | ||
"@nomiclabs/**/web3-shh": `${patch}`, | ||
"@nomiclabs/**/web3-utils": `${patch}` | ||
} | ||
|
||
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||
console.log(`Yarn will resolve Web3 packages in "${process.argv[2]}"" to...`); | ||
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); | ||
|
||
console.log(JSON.stringify(targetPackage.resolutions, null, ' ')); | ||
|
||
fs.writeFileSync(targetPackagePath, JSON.stringify(targetPackage, null, ' ')); | ||
|
This file contains 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