Skip to content

Commit 2988413

Browse files
authored
Merge pull request #4 from stellarspot/feature/publish-service-test
#2 Add integration test
2 parents b051cd0 + 5ac6db3 commit 2988413

File tree

4 files changed

+716
-8
lines changed

4 files changed

+716
-8
lines changed

.circleci/config.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,77 @@ jobs:
33
build:
44
docker:
55
- image: ubuntu:latest
6-
working_directory: /root/go/src/github.com/singnet
6+
working_directory: /root/singnet/src/github.com/singnet/platform-pipeline
77
environment:
8-
GOPATH: /root/go
9-
SINGNET_REPOS: /root/go/src/github.com/singnet
8+
GOPATH: /root/singnet
9+
SINGNET_REPOS: /root/singnet/src/github.com/singnet
1010
steps:
1111
- run:
1212
name: Install tools
1313
command: |
1414
export PATH=$PATH:$GOPATH/bin
15+
mkdir $GOPATH/download
16+
cd $GOPATH/download
1517
apt-get update
1618
apt-get -y install sudo wget git
1719
# Install NodeJS toolset
1820
sudo apt-get -y install nodejs npm
19-
# install protobuf
21+
# install Go tools
2022
sudo apt-get -y install golang go-dep golang-goprotobuf-dev golint
2123
# install IPFS
2224
wget https://dist.ipfs.io/go-ipfs/v0.4.17/go-ipfs_v0.4.17_linux-amd64.tar.gz
2325
tar xvfz go-ipfs_*.tar.gz
24-
cp ./go-ipfs/ipfs $GOPATH/bin
26+
cp ./go-ipfs/ipfs /usr/local/bin
2527
# Installl Python
2628
sudo apt-get -y install python3 python3-pip
2729
# Install other
2830
sudo apt-get -y install libudev-dev libusb-1.0-0-dev
31+
- run:
32+
name: Build token-contracts
33+
command: |
34+
cd $SINGNET_REPOS
35+
git clone https://github.com/singnet/token-contracts.git
36+
cd token-contracts
37+
npm install
38+
npm run-script compile
39+
npm run-script package-npm
2940
- run:
3041
name: Build platform-contracts
3142
command: |
3243
cd $SINGNET_REPOS
3344
git clone https://github.com/singnet/platform-contracts.git
3445
cd platform-contracts
35-
npm install
3646
npm install ganache-cli
47+
# install token-contracts from local dir
48+
npm install $SINGNET_REPOS/token-contracts/build/npm-module
49+
npm install
50+
npm run-script compile
51+
npm run-script package-npm
3752
- run:
3853
name: Build snet-cli
3954
command: |
4055
cd $SINGNET_REPOS
4156
git clone https://github.com/singnet/snet-cli.git
4257
cd snet-cli
58+
# install token-contracts and platform-contracts from local dir
59+
cd blockchain/
60+
npm install $SINGNET_REPOS/token-contracts/build/npm-module
61+
npm install $SINGNET_REPOS/platform-contracts/build/npm-module
62+
cd ..
4363
./scripts/blockchain install
4464
pip3 install -e .
4565
- run:
4666
name: Build snet-daemon
4767
command: |
4868
export PATH=$PATH:$GOPATH/bin
49-
rm -rf $GOPATH/bin
5069
cd $SINGNET_REPOS
5170
git clone https://github.com/singnet/snet-daemon.git
5271
cd snet-daemon
72+
# install token-contracts and platform-contracts from local dir
73+
cd resources/blockchain
74+
npm install $SINGNET_REPOS/token-contracts/build/npm-module
75+
npm install $SINGNET_REPOS/platform-contracts/build/npm-module
76+
cd ../..
5377
./scripts/install
5478
./scripts/build linux amd64
5579
- run:
@@ -59,4 +83,14 @@ jobs:
5983
cd $SINGNET_REPOS
6084
git clone https://github.com/singnet/example-service.git
6185
cd example-service
62-
pip3 install -r requirements.txt
86+
pip3 install -r requirements.txt
87+
- checkout
88+
- run:
89+
name: Run integration tests
90+
command: |
91+
export PATH=$PATH:$GOPATH/bin
92+
mkdir $GOPATH/log
93+
go get github.com/DATA-DOG/godog/cmd/godog
94+
# Disable TensorFlow warnings wich pollute example-service log file
95+
export TF_CPP_MIN_LOG_LEVEL=2
96+
godog
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Feature: Publish example service
2+
3+
Scenario: Run all services and publish example service
4+
Given Ethereum network is running on port 8545
5+
Given Contracts are deployed using Truffle
6+
Given IPFS is running with API port 5002 and Gateway port 8081
7+
Given Identity is created with user "snet-user" and private key "0xc71478a6d0fe44e763649de0a0deb5a080b788eefbbcf9c6f7aef0dd5dbd67e0"
8+
Given snet is configured with Ethereum RPC endpoint 8545
9+
Given snet is configured with IPFS endpoint 5002
10+
When Organization is added:
11+
| organization | address | member |
12+
| ExampleOrganization | 0x4e74fefa82e83e0964f0d9f53c68e03f7298a8b2 | 0x3b2b3c2e2e7c93db335e69d827f3cc4bc2a2a2cb |
13+
When example-service is registered
14+
| name | price | endpoint | tags | description |
15+
| ExampleOrganization | 1 | http://localhost:8080 | example service | Example service |
16+
When example-service is published to network
17+
| agent factory address | registry address |
18+
| 0x5c7a4290f6f8ff64c69eeffdfafc8644a4ec3a4e | 0x4e74fefa82e83e0964f0d9f53c68e03f7298a8b2 |
19+
When example-service is run with snet-daemon
20+
| daemon port | ethereum endpoint port | passthrough endpoint port | agent contract address | private key |
21+
| 8080 | 8545 | 5001 | 0xD39321C654351b412F4D13B45E7020FE9f99f608 | ba398df3130586b0d5e6ef3f757bf7fe8a1299d4b7268fdaae415952ed30ba87 |
22+
Then SingularityNET job is created
23+
| max price | agent contract address |
24+
| 100000000 | 0xD39321C654351b412F4D13B45E7020FE9f99f608 |

0 commit comments

Comments
 (0)