Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit eebf851

Browse files
committed
[FAB-11207] Fix local integration tests
This change fixes override paths and matchers for host run integration tests. The scripts now also wait for the docker host to become available. Change-Id: Id9e7017641cc372c30fa13f831d5ff96fb5ea6c7 Signed-off-by: Troy Ronda <troy@troyronda.com>
1 parent 4fadae5 commit eebf851

File tree

12 files changed

+70
-9
lines changed

12 files changed

+70
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ endif
193193
BASE_DOCKER_COMPOSE_FILES := -f ./docker-compose.yaml
194194
ifeq ($(FABRIC_SDK_ENABLE_CHAINCODED),true)
195195
BASE_DOCKER_COMPOSE_FILES := -f ./docker-compose-chaincoded.yaml $(BASE_DOCKER_COMPOSE_FILES)
196-
export CORE_VM_ENDPOINT=http://chaincoded.example.com:2375
196+
export CORE_VM_ENDPOINT=http://chaincoded.example.com:9375
197197
else
198198
BASE_DOCKER_COMPOSE_FILES := -f ./docker-compose-std.yaml $(BASE_DOCKER_COMPOSE_FILES)
199199
endif

test/fixtures/config/overrides/local_entity_matchers_bootstrap.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ entityMatchers:
1111
sslTargetOverrideUrlSubstitutionExp: $1.org1.example.com
1212
mappedHost: local.peer0.org1.example.com
1313

14-
- pattern: peer0.org2.example.com:8051
15-
urlSubstitutionExp: localhost:8051
16-
sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com
14+
## TODO added below peer to ignore list, to avoid these revoked peer to conflict with bootstrap test
15+
- pattern: peer1.org2.example.com:(\d+)
16+
ignoreEndpoint: true
17+
18+
- pattern: peer1.org2.example.com
19+
ignoreEndpoint: true
20+
21+
- pattern: (\w+).org2.example.com:(\d+)
22+
urlSubstitutionExp: localhost:$2
23+
sslTargetOverrideUrlSubstitutionExp: $1.org2.example.com
1724
mappedHost: local.peer0.org2.example.com
1825

1926
orderer:

test/fixtures/dockerenv/docker-compose-chaincoded.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ services:
3131
- ../../../test/fixtures/testdata/src/github.com/example_pvt_cc:/opt/gopath/src/github.com/example_pvt_cc
3232
command: /opt/gopath/src/github.com/hyperledger/fabric-sdk-go/test/scripts/chaincoded.sh
3333
#comment out logging.driver in order to render the debug logs
34-
logging:
35-
driver: none
34+
#logging:
35+
# driver: none
3636
networks:
3737
default:
3838
aliases:
3939
- chaincoded.example.com
40+
ports:
41+
- "9375:9375"
4042
expose:
41-
- "2375"
43+
- "9375"
4244
depends_on:
4345
- dockerd

test/fixtures/dockerenv/docker-compose-negative.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ services:
1818
- FABRIC_FIXTURE_VERSION
1919
- FABRIC_SDK_CLIENT_EVENTSERVICE_TYPE
2020
- TEST_CHANGED_ONLY
21+
- CORE_VM_ENDPOINT
2122
volumes:
2223
- ../../../:/opt/gopath/src/github.com/hyperledger/fabric-sdk-go
2324
command: /opt/gopath/src/github.com/hyperledger/fabric-sdk-go/test/scripts/negative.sh

test/fixtures/dockerenv/docker-compose-nopkcs11-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- FABRIC_SDK_CLIENT_EVENTSERVICE_TYPE
2020
- E2E_ONLY
2121
- TEST_CHANGED_ONLY
22+
- CORE_VM_ENDPOINT
2223
volumes:
2324
- ../../../:/opt/gopath/src/github.com/hyperledger/fabric-sdk-go
2425
command: /opt/gopath/src/github.com/hyperledger/fabric-sdk-go/test/scripts/integration.sh

test/fixtures/dockerenv/docker-compose-pkcs11-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- FABRIC_FIXTURE_VERSION
2020
- FABRIC_SDK_CLIENT_EVENTSERVICE_TYPE
2121
- TEST_CHANGED_ONLY
22+
- CORE_VM_ENDPOINT
2223
volumes:
2324
- ../../../:/opt/gopath/src/github.com/hyperledger/fabric-sdk-go
2425
command: bash -c "/opt/gopath/src/github.com/hyperledger/fabric-sdk-go/test/scripts/unit-pkcs11.sh && /opt/gopath/src/github.com/hyperledger/fabric-sdk-go/test/scripts/integration-pkcs11.sh"

test/integration/base_test_setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func GetConfigPath(filename string) string {
164164

165165
// GetConfigOverridesPath returns the path to the named config override fixture file
166166
func GetConfigOverridesPath(filename string) string {
167-
const configPath = "test/fixtures/config/overrides"
167+
const configPath = "test/fixtures/config"
168168
return path.Join(goPath(), "src", metadata.Project, configPath, "overrides", filename)
169169
}
170170

test/scripts/chaincoded.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ GOPATH="${GOPATH:-$HOME/go}"
1313
mkdir -p ${GOPATH}/src/github.com/hyperledger
1414
ln -s ${GOPATH}/src/chaincoded/vendor/github.com/hyperledger/fabric ${GOPATH}/src/github.com/hyperledger/fabric
1515

16+
echo "Installing chaincodes ..."
1617
go install github.com/example_cc
1718
go install github.com/example_pvt_cc
1819
go install chaincoded/cmd/chaincoded
@@ -24,4 +25,6 @@ PEERS=(
2425
peer1.org2.example.com:9052
2526
)
2627

27-
chaincoded ":2375" ${PEERS[@]}
28+
# Remove dev/null redirection to see chaincode logs
29+
echo "Running chaincoded ..."
30+
chaincoded ":9375" ${PEERS[@]} > /dev/null 2> /dev/null

test/scripts/integration-pkcs11.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ SCRIPT_DIR="$(dirname "$0")"
3434
REPO="github.com/hyperledger/fabric-sdk-go"
3535

3636
source ${SCRIPT_DIR}/lib/find_packages.sh
37+
source ${SCRIPT_DIR}/lib/docker.sh
3738

3839
echo "Running" $(basename "$0")
3940

@@ -96,6 +97,8 @@ do
9697
rm -rf private.p8
9798
done
9899

100+
waitForCoreVMUp
101+
99102
echo "Code level ${FABRIC_SDKGO_CODELEVEL_TAG} (Fabric ${FABRIC_FIXTURE_VERSION})"
100103
echo "Running integration tests ..."
101104

test/scripts/integration.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ SCRIPT_DIR="$(dirname "$0")"
3434
REPO="github.com/hyperledger/fabric-sdk-go"
3535

3636
source ${SCRIPT_DIR}/lib/find_packages.sh
37+
source ${SCRIPT_DIR}/lib/docker.sh
3738

3839
echo "Running" $(basename "$0")
3940

@@ -84,6 +85,8 @@ if [ ${#PKGS[@]} -eq 0 ]; then
8485
exit 0
8586
fi
8687

88+
waitForCoreVMUp
89+
8790
echo "Code level ${FABRIC_SDKGO_CODELEVEL_TAG} (Fabric ${FABRIC_FIXTURE_VERSION})"
8891
echo "Running integration tests ..."
8992

0 commit comments

Comments
 (0)