Skip to content

Commit

Permalink
[FAB-9574] Sub interfaces Integration Test
Browse files Browse the repository at this point in the history
	Testing EndpointConfig interface override with
	sub interfaces

	Also added localhost URLs in Orderer/Peer/CA configs to
	test local (TEST_LOCAL=true)

	Also added integration tests fixes for Fabric v1.2

Change-Id: I93c8f73aaac3b36279fa1f785229d475d68fbf2f
Signed-off-by: Baha Shaaban <baha.shaaban@securekey.com>
  • Loading branch information
Baha Shaaban committed May 2, 2018
1 parent 72a5fdb commit ee50b2f
Show file tree
Hide file tree
Showing 9 changed files with 980 additions and 48 deletions.
2 changes: 1 addition & 1 deletion pkg/fab/endpointconfig.go
Expand Up @@ -461,7 +461,7 @@ func (c *EndpointConfig) ChannelOrderers(name string) ([]fab.OrdererConfig, erro
}

// TLSCACertPool returns the configured cert pool. If a certConfig
// is provided, the certficate is added to the pool
// is provided, the certificate is added to the pool
func (c *EndpointConfig) TLSCACertPool(certs ...*x509.Certificate) (*x509.CertPool, error) {
return c.tlsCertPool.Get(certs...)
}
Expand Down
43 changes: 43 additions & 0 deletions test/fixtures/config/config_test_crypto_bccsp.yaml
@@ -0,0 +1,43 @@
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# The network connection profile provides client applications the information about the target
# blockchain network that are necessary for the applications to interact with it. These are all
# knowledge that must be acquired from out-of-band sources. This file provides such a source.
#


#
# Schema version of the content. Used by the SDK to apply the corresponding parsing rules.
#
version: 1.0.0

#
# The client section used by GO SDK.
#
client:
# Some SDKs support pluggable KV stores, the properties under "credentialStore"
# are implementation specific
credentialStore:
# [Optional]. Used by user store. Not needed if all credentials are embedded in configuration
# and enrollments are performed elswhere.
path: "/tmp/state-store"

# [Optional]. Specific to the CryptoSuite implementation used by GO SDK. Software-based implementations
# requiring a key store. PKCS#11 based implementations does not.
cryptoStore:
# Specific to the underlying KeyValueStore that backs the crypto key store.
path: /tmp/msp

# BCCSP config for the client. Used by GO SDK.
BCCSP:
security:
enabled: true
default:
provider: "SW"
hashAlgorithm: "SHA2"
softVerify: true
level: 256
34 changes: 34 additions & 0 deletions test/integration/e2e/configless/end_to_end_test.go
@@ -0,0 +1,34 @@
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

package configless

import (
"testing"

"github.com/hyperledger/fabric-sdk-go/pkg/core/config"
"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
"github.com/hyperledger/fabric-sdk-go/test/integration/e2e"
)

// this test mimics the original e2e test with the difference of injecting EndpointConfig interface functions implementations
// to programmatically supply configs instead of using a yaml file. With this change, application developers can fetch
// configs from any source as long as they provide their own implementations.

func TestE2E(t *testing.T) {
configPath := "../../../fixtures/config/config_test_crypto_bccsp.yaml"
//Using same Run call as e2e package but with programmatically overriding interfaces
e2e.RunWithoutSetup(t, config.FromFile(configPath),
fabsdk.WithConfigEndpoint(endpointConfigImpls...))

// TODO test with below line once IdentityConfig and CryptoConfig are split into
// TODO sub interfaces like EndpointConfig and pass them in like WithConfigEndpoint,
// TODO this will allow to test overriding all config interfaces without the need of a config file
// TODO maybe add config.BareBone() in the SDK to get a configProvider without a config file instead
// TODO of passing in an empty file as in below comment
// use an empty config file to fully depend on injected EndpointConfig interfaces
//configPath = "../../../pkg/core/config/testdata/viper-test.yaml"
}

0 comments on commit ee50b2f

Please sign in to comment.