Skip to content

Commit ce5ca99

Browse files
authored
Merge branch 'staging' into remove-zproxy
2 parents a1b8c09 + 2727afc commit ce5ca99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+198
-455
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -60,60 +60,3 @@ jobs:
6060
files: ./code/go/0chain.net/coverage.txt
6161
flags: Unit-Tests
6262
verbose: true
63-
64-
integration-tests:
65-
name: Integration Tests
66-
runs-on: [self-hosted,docker-builds]
67-
timeout-minutes: 40
68-
steps:
69-
- name: Setup go 1.18
70-
uses: actions/setup-go@v2
71-
with:
72-
go-version: '1.18' # The Go version to download (if necessary) and use.
73-
74-
# - uses: actions/cache@v2
75-
# with:
76-
# path: ~/go/pkg/mod
77-
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
78-
# restore-keys: |
79-
# ${{ runner.os }}-go-
80-
81-
- name: Clone Blobber
82-
uses: actions/checkout@v2
83-
84-
- name: Install Postgres
85-
run: |
86-
./docker.local/bin/blobber.init.setup.sh
87-
cd docker.local/blobber1
88-
../bin/blobber.start_github.sh
89-
docker ps
90-
- name: Run Tests
91-
run: |
92-
echo ===============[ kill blobber instance ]====================
93-
sudo apt-get update -y
94-
sudo apt-get install lsof -y
95-
96-
ps aux | grep blobber
97-
98-
n=$(sudo lsof -i tcp:35051 | grep -v PID | wc -l)
99-
[ $n -gt 0 ] && sudo kill -9 $(lsof -i tcp:35051 | awk '{print $2}' | grep -v PID) && echo "> killed running blobber for integration-tests" || echo "> no blobber is running for integration-tests"
100-
101-
echo ""
102-
make local-build
103-
sudo make local-run &
104-
sleep 15
105-
running=0
106-
echo ===============[ checking blobber status ]====================
107-
for i in {1..10}
108-
do
109-
echo "[$i/10] checking blobber status"
110-
curl 127.0.0.1:25051 && break || sleep 2
111-
done
112-
113-
echo ===============[ run tests ]====================
114-
#sudo make integration-tests
115-
go=$(which go)
116-
root=$(pwd)
117-
sudo CGO_ENABLED=1 root=$root integration=1 $go test -tags bn256 -tags=integration ./...
118-
119-
sudo pkill -9 blobber

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ lint:
2222
golangci-lint run --timeout 2m0s;
2323

2424

25-
.PHONY: integration-tests
26-
integration-tests:
27-
CGO_ENABLED=1 root=$(ROOT) integration=1 go test -p 1 -tags bn256 ./...
28-
2925
.PHONY: local-init
3026
local-init:
3127
@echo "=========================[ init blobber ]========================="
@@ -50,7 +46,7 @@ local-build: local-init
5046
.PHONY: local-run
5147
local-run:
5248
@echo "=========================[ run blobber ]========================="
53-
cd ./dev.local/ && integration=1 ./data/blobber/blobber \
49+
cd ./dev.local/ && ./data/blobber/blobber \
5450
--port 25051 \
5551
--grpc_port 35051 \
5652
--hostname 127.0.0.1 \

code/go/0chain.net/blobber/config.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ func setupConfig(configDir string, deploymentMode int) {
7878

7979
config.Configuration.PGUserName = viper.GetString("pg.user")
8080
config.Configuration.PGPassword = viper.GetString("pg.password")
81-
if isIntegrationTest {
82-
config.Configuration.DBHost = "localhost"
83-
} else {
84-
config.Configuration.DBHost = viper.GetString("db.host")
85-
}
81+
config.Configuration.DBHost = viper.GetString("db.host")
8682
config.Configuration.DBName = viper.GetString("db.name")
8783
config.Configuration.DBPort = viper.GetString("db.port")
8884
config.Configuration.DBUserName = viper.GetString("db.user")

code/go/0chain.net/blobber/filestore.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ import (
88

99
func setupFileStore() (err error) {
1010
fmt.Print("> setup file store")
11-
var fs filestore.FileStorer
12-
if isIntegrationTest {
13-
fs = &filestore.MockStore{}
14-
} else {
15-
fs = &filestore.FileStore{}
16-
17-
}
11+
fs := &filestore.FileStore{}
1812

1913
err = fs.Initialize()
2014
if err != nil {

code/go/0chain.net/blobber/flags.go

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,23 @@ package main
33
import (
44
"flag"
55
"fmt"
6-
"os"
76
)
87

98
var (
10-
deploymentMode int
11-
keysFile string
12-
minioFile string
13-
mountPoint string
14-
metadataDB string
15-
logDir string
16-
httpPort int
17-
hostname string
18-
configDir string
19-
grpcPort int
20-
isIntegrationTest bool
21-
httpsPort int
22-
httpsKeyFile string
23-
httpsCertFile string
24-
hostUrl string
9+
deploymentMode int
10+
keysFile string
11+
minioFile string
12+
mountPoint string
13+
metadataDB string
14+
logDir string
15+
httpPort int
16+
hostname string
17+
configDir string
18+
grpcPort int
19+
httpsPort int
20+
httpsKeyFile string
21+
httpsCertFile string
22+
hostUrl string
2523
)
2624

2725
func init() {
@@ -58,7 +56,6 @@ func parseFlags() {
5856
if httpPort <= 0 && httpsPort <= 0 {
5957
panic("Please specify --port or --https-port which is the port on which requests are accepted")
6058
}
61-
isIntegrationTest = os.Getenv("integration") == "1"
6259

6360
if httpsPort > 0 && (httpsCertFile == "" || httpsKeyFile == "") {
6461
panic("Please specify --https-cert-file and --https-key-file if you are using --https-port")

code/go/0chain.net/blobber/grpc.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//go:build !integration_tests
2-
// +build !integration_tests
3-
41
package main
52

63
import (

code/go/0chain.net/blobber/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ func main() {
3939
panic(err)
4040
}
4141

42-
// only enabled with "// +build integration_tests"
43-
initIntegrationsTests(node.Self.ID)
42+
// prepare is to configure more.
43+
// when enabled "// +build integration_tests", this sets blobber for conductor tests.
44+
prepareBlobber(node.Self.ID)
4445

4546
if err := registerOnChain(); err != nil {
4647
logging.Logger.Error("Error register on blockchain" + err.Error())

code/go/0chain.net/blobber/integration_tests.go renamed to code/go/0chain.net/blobber/prepare_conductor_testing.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//go:build integration_tests
22
// +build integration_tests
33

4+
// Integration tests is also called conductor tests.
5+
// TODO. There seems to be missing setup for conductor as only prepareBlobber() is hooked.
6+
47
package main
58

69
import (
@@ -10,13 +13,11 @@ import (
1013
)
1114

1215
// start lock, where the miner is ready to connect to blockchain (BC)
13-
func initIntegrationsTests(id string) {
16+
func prepareBlobber(id string) {
1417
logging.Logger.Info("integration tests")
1518
crpc.Init(id)
1619
}
1720

18-
func shutdownIntegrationTests() {
21+
func prepareBlobberShutdown() {
1922
crpc.Shutdown()
2023
}
21-
22-
func startGRPCServer() {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:build !integration_tests
2+
// +build !integration_tests
3+
4+
package main
5+
6+
// the following prepare functions are noop
7+
8+
func prepareBlobber(id string) {}
9+
10+
func prepareBlobberShutdown() {} //nolint:unused,deadcode // looks like it is being used in integration test

code/go/0chain.net/blobber/stub.go

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)