Skip to content

Commit

Permalink
[FAB-8442] map network hosts config with static-config
Browse files Browse the repository at this point in the history
Unknown network hosts can be mapped to hosts from static config
for peers and orderers through regular expression matching

Change-Id: I2ca0068ec7136d90ddcc932d00611c41ef4e5de3
Signed-off-by: Pavan Kappara <[email protected]>
  • Loading branch information
Pavan Kappara committed Mar 8, 2018
1 parent 151405c commit e8fa23b
Show file tree
Hide file tree
Showing 20 changed files with 1,542 additions and 29 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ FIXTURE_DOCKER_REMOVE_FORCE ?= false
# Options for exercising unit tests (overridable)
FABRIC_SDK_DEPRECATED_UNITTEST ?= false

#config files
INT_TESTS_LOCAL_CONFIG_FILE := config_test_local.yaml

# Code levels to exercise integration/e2e tests against (overridable)
FABRIC_STABLE_INTTEST ?= true
FABRIC_STABLE_PKCS11_INTTEST ?= false
Expand Down Expand Up @@ -290,7 +293,7 @@ endif

.PHONY: integration-tests-local
integration-tests-local: temp-clean depend populate
FABRIC_CRYPTOCONFIG_VERSION=$(FABRIC_CRYPTOCONFIG_VER) FABRIC_SDKGO_CODELEVEL_VER=$(FABRIC_CODELEVEL_VER) FABRIC_SDKGO_CODELEVEL_TAG=$(FABRIC_CODELEVEL_TAG) $(TEST_SCRIPTS_PATH)/integration.sh
FABRIC_CRYPTOCONFIG_VERSION=$(FABRIC_CRYPTOCONFIG_VER) FABRIC_SDKGO_CODELEVEL_VER=$(FABRIC_CODELEVEL_VER) FABRIC_SDKGO_CODELEVEL_TAG=$(FABRIC_CODELEVEL_TAG) CONFIG_FILE=$(INT_TESTS_LOCAL_CONFIG_FILE) $(TEST_SCRIPTS_PATH)/integration.sh

.PHONY: dockerenv-prev-up
dockerenv-prev-up: clean
Expand Down Expand Up @@ -395,7 +398,7 @@ populate-clean:

.PHONY: temp-clean
temp-clean:
-rm -Rf /tmp/enroll_user /tmp/msp /tmp/keyvaluestore /tmp/hfc-kvs /tmp/state
-rm -Rf /tmp/enroll_user /tmp/msp /tmp/keyvaluestore /tmp/hfc-kvs /tmp/state /tmp/state-store
-rm -f integration-report.xml report.xml

.PHONY: clean
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ You need:
#### Enable local hostnames

You will need to set the following hosts to 127.0.0.1 (typically in /etc/hosts):
ca.org1.example.com ca.org2.example.com peer0.org1.example.com peer1.org1.example.com peer0.org2.example.com peer1.org2.example.com orderer.example.com
ca.org1.example.com ca.org2.example.com

#### Testing with Fabric Images at Docker Hub

Expand Down
11 changes: 11 additions & 0 deletions pkg/context/api/core/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type NetworkConfig struct {
Orderers map[string]OrdererConfig
Peers map[string]PeerConfig
CertificateAuthorities map[string]CAConfig
EntityMatchers map[string][]MatchConfig
}

// ClientConfig provides the definition of the client configuration
Expand Down Expand Up @@ -207,3 +208,13 @@ type TLSKeyPair struct {
Key TLSConfig
Cert TLSConfig
}

// MatchConfig contains match pattern and substitution pattern
// for pattern matching of network configured hostnames with static config
type MatchConfig struct {
Pattern string
URLSubstitutionExp string
EventURLSubstitutionExp string
SSLTargetOverrideURLSubstitutionExp string
MappedHost string
}
Loading

0 comments on commit e8fa23b

Please sign in to comment.