Skip to content

Commit

Permalink
[FAB-8442] map CAConfig to static host
Browse files Browse the repository at this point in the history
added instructions to readme for the use of config_test_local.yaml
and fixed a remove certificate bug

Change-Id: Ida97929993c2ff636c7ef746a990224943581665
Signed-off-by: Pavan Kappara <pavan.kappara@securekey.com>
  • Loading branch information
Pavan Kappara committed Mar 13, 2018
1 parent 8f5d6f4 commit 5c378d3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ Fabric should now be running. In a different shell, run integration tests
cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go

# Use script to setup parameters for integration tests and execute them
make integration-tests-local
# Previously we use to have hostnames like Fabric CA server, orderer and peer pointed to localhost
# Now since we removed this now, We will be using a different config file config_test_local.yaml
# which has the Fabric CA server, orderer and peers pointed to localhost
make -args configFile=config_test_local.yaml integration-tests-local

# Or more generally, run integration tests at a different code level (prev, stable, prerelease, devstable)
# and fixture target version
Expand All @@ -156,12 +159,15 @@ make integration-tests-local


```bash
# Previously we use to have hostnames like Fabric CA server, orderer and peer pointed to localhost
# Now since we removed this now, We will be using a different config file config_test_local.yaml
# which has the Fabric CA server, orderer and peers pointed to localhost
# It is also possible to run integration tests using go test directly. For example:
#cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/test/integration/
#go test
#go -args configFile=config_test_local.yaml test

#cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/test/integration/orgs
#go test
#go -args configFile=config_test_local.yaml test

# You should review test/scripts/integration.sh for options and details.
# Note: you should generally prefer the scripted version to setup parameters for you.
Expand Down
12 changes: 10 additions & 2 deletions test/integration/msp/enrollment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ import (

const (
IdentityTypeUser = "User"
sdkConfigFile = "../../fixtures/config/config_test.yaml"
)

func TestRegisterEnroll(t *testing.T) {

configProvider := config.FromFile(sdkConfigFile)
configProvider := config.FromFile("../" + integration.ConfigTestFile)

// Instantiate the SDK
sdk, err := fabsdk.New(configProvider)

if err != nil {
t.Fatalf("SDK init failed: %v", err)
}

// Delete all private keys from the crypto suite store
// and users from the user store at the end
netConfig := sdk.Config()
keyStorePath := netConfig.KeyStorePath()
credentialStorePath := netConfig.CredentialStorePath()
defer integration.CleanupTestPath(t, keyStorePath)
defer integration.CleanupTestPath(t, credentialStorePath)

ctxProvider := sdk.Context()

// Get the MSP.
Expand Down
9 changes: 9 additions & 0 deletions test/integration/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package integration

import (
"math/rand"
"os"
"testing"
"time"

"github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
Expand Down Expand Up @@ -170,3 +172,10 @@ func ProposalProcessors(targets []fab.Peer) []fab.ProposalProcessor {
}
return proposalProcessors
}

func CleanupTestPath(t *testing.T, storePath string) {
err := os.RemoveAll(storePath)
if err != nil {
t.Fatalf("Cleaning up directory '%s' failed: %v", storePath, err)
}
}

0 comments on commit 5c378d3

Please sign in to comment.