Skip to content
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

Add e2e tests #130

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
12 changes: 12 additions & 0 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ jobs:
- name: Unit tests with coverage
run: go test -race -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic -v ./...

- name: Mosaic-1 e2e test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great if these tests ran as separate jobs to not block unit tests.

run: |
./oasis-evm-web3-gateway --config conf/tests.yml &
git clone https://github.com/cgewecke/mosaic-1.git
cp tests/tools/buidler.config.js mosaic-1
cd mosaic-1
yarn
yarn test
cd ..
killall oasis-evm-web3-gateway

- name: Shutdown oasis-node
run: killall oasis-node
if: always()
Expand All @@ -80,3 +91,4 @@ jobs:

- name: Upload to codecov.io
uses: codecov/[email protected]

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To run tests:
Start PostgreSQL (for testing [Postgres Docker](https://hub.docker.com/_/postgres) container can be used):

```bash
docker run --rm --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:13.3-alpine
docker run --name postgres --rm -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -p 5432:5432 -d postgres
```

In a separate terminal, start an Oasis development network:
Expand Down
15 changes: 14 additions & 1 deletion rpc/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,18 @@ func (api *PublicAPI) Call(args utils.TransactionArgs, blockNum ethrpc.BlockNumb
return res, nil
}

// SendRawTransaction send a raw Ethereum transaction.
// SendTransaction signs and sends an Ethereum transaction.
//func (api *PublicAPI) SendTransaction(ethTx *ethtypes.Transaction) (common.Hash, error) {
// logger := api.Logger.With("method", "eth_sendTransaction")
// logger.Debug("request", "tx", ethTx)
// data, err := ethTx.MarshalBinary()
// if err != nil {
// return common.Hash{}, err
// }
// return api.SendRawTransaction(data)
//}

// SendRawTransaction sends a raw Ethereum transaction.
func (api *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) {
logger := api.Logger.With("method", "eth_sendRawTransaction")
logger.Debug("request", "length", len(data))
Expand Down Expand Up @@ -657,6 +668,8 @@ func (api *PublicAPI) Accounts() ([]common.Address, error) {
logger.Debug("request")

addresses := make([]common.Address, 0)
// addresses = append(addresses, common.HexToAddress("0x90adE3B7065fa715c7a150313877dF1d33e777D5")) // Dave
// addresses = append(addresses, common.HexToAddress("0x33a8Ba274FEdFeed6A08d09eC524a1E1A6Da8262")) // Eugene
return addresses, nil
}

Expand Down
22 changes: 22 additions & 0 deletions tests/tools/buidler.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
usePlugin('@nomiclabs/buidler-truffle5');

module.exports = {
defaultNetwork: 'local',
networks: {
local: {
url: "http://localhost:8545",
accounts:
{ mnemonic: "tray ripple elevator ramp insect butter top mouse old cinnamon panther chief"} ,
}
},
solc: {
version: '0.5.13',
optimizer: {
enabled: false
},
evmVersion: 'istanbul'
},
mocha: {
timeout: 50000
}
};