This repository was archived by the owner on Apr 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +36
-5
lines changed
pkg/fabric-client/channel Expand file tree Collapse file tree 5 files changed +36
-5
lines changed Original file line number Diff line number Diff line change 99# depend: installs test dependencies
1010# unit-test: runs all the unit tests
1111# integration-test: runs all the integration tests
12+ # race-test: runs tests with race detector
1213# checks: runs all check conditions (license, spelling, linting)
1314# clean: stops docker conatainers used for integration testing
1415# mock-gen: generate mocks needed for testing (using mockgen)
@@ -44,6 +45,9 @@ integration-test: clean depend
4445
4546integration-tests : integration-test
4647
48+ race-test :
49+ @test/scripts/racedetector.sh
50+
4751mock-gen :
4852 go get -u github.com/golang/mock/gomock
4953 go get -u github.com/golang/mock/mockgen
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ package channel
99import (
1010 "fmt"
1111 "net"
12+ "os"
13+ "strconv"
1214 "testing"
1315
1416 "google.golang.org/grpc"
@@ -163,7 +165,14 @@ func TestConcurrentPeers(t *testing.T) {
163165}
164166
165167func TestConcurrentOrderers (t * testing.T ) {
166- const numOrderers = 10000
168+ // Determine number of orderers to use - environment can override
169+ const numOrderersDefault = 10000
170+ numOrderersEnv := os .Getenv ("TEST_MASSIVE_ORDERER_COUNT" )
171+ numOrderers , err := strconv .Atoi (numOrderersEnv )
172+ if err != nil {
173+ numOrderers = numOrderersDefault
174+ }
175+
167176 channel , err := setupMassiveTestChannel (0 , numOrderers )
168177 if err != nil {
169178 t .Fatalf ("Failed to create massive channel: %s" , err )
Original file line number Diff line number Diff line change 77
88# Environment variables that affect this script:
99# USE_PREBUILT_IMAGES: Integration tests are run against fabric docker images.
10- # Can be latest tagged (FALSE) or tags specified in .env (default)
11- # ARCH: Fabric docker images architecture
10+ # Can be latest tagged (FALSE) or tags specified in .env (default).
11+ # ARCH: Fabric docker images architecture.
1212# If not set, ARCH defaults to the value specified in .env.
13+ # GOTESTFLAGS: Flags are added to the go test command.
14+ # LDFLAGS: Flags are added to the go test command (example: -ldflags=-s).
1315
1416# Packages to include in test run
1517PKGS=` go list github.com/hyperledger/fabric-sdk-go/test/integration/... 2> /dev/null | \
@@ -26,7 +28,7 @@ cd ./test/fixtures && docker-compose up --force-recreate -d
2628
2729echo " Running integration tests..."
2830cd ../../
29- gocov test $LDFLAGS $PKGS -p 1 -timeout=10m | gocov-xml > integration-report.xml
31+ gocov test $GOTESTFLAGS $ LDFLAGS $PKGS -p 1 -timeout=10m | gocov-xml > integration-report.xml
3032
3133if [ $? -eq 0 ]
3234then
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # Copyright SecureKey Technologies Inc. All Rights Reserved.
4+ #
5+ # SPDX-License-Identifier: Apache-2.0
6+ #
7+
8+ SCRIPT_PATH=$( dirname " $0 " )
9+
10+ export GOTESTFLAGS=" $GOTESTFLAGS -race -v"
11+ export TEST_MASSIVE_ORDERER_COUNT=2000
12+ $SCRIPT_PATH /unit.sh
13+ $SCRIPT_PATH /integration.sh
Original file line number Diff line number Diff line change 44#
55# SPDX-License-Identifier: Apache-2.0
66#
7+ # Environment variables that affect this script:
8+ # GOTESTFLAGS: Flags are added to the go test command.
9+ # LDFLAGS: Flags are added to the go test command (example: -ldflags=-s).
710
811set -e
912
@@ -12,4 +15,4 @@ PKGS=`go list github.com/hyperledger/fabric-sdk-go/... 2> /dev/null | \
1215 grep -v /vendor/ | \
1316 grep -v /test/`
1417echo " Running tests..."
15- gocov test $LDFLAGS $PKGS -p 1 -timeout=5m | gocov-xml > report.xml
18+ gocov test $GOTESTFLAGS $ LDFLAGS $PKGS -p 1 -timeout=5m | gocov-xml > report.xml
You can’t perform that action at this time.
0 commit comments