-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAB-950 self-contained chaincode deploy test setup
Tests that need to deploy chaincode need the following setup: - GOPATH environment variable - chaincode available at the folder corresponding to $GOPATH/src/<the GO package> have this be part of the test fixture so contributors don't have to manually set it up locally. set process.env.GOPATH in the code to the test fixture folder just for the test execution. Change-Id: I348a5b32fe52a67498c3578e9c4918cf4294bc39 Signed-off-by: Jim Zhang <[email protected]>
- Loading branch information
1 parent
5202a3c
commit 4498b18
Showing
5 changed files
with
7 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,8 @@ | ||
var fs = require('fs-extra'); | ||
var path = require('path'); | ||
|
||
module.exports.CHAINCODE_PATH = 'github.com/example_cc'; | ||
module.exports.CHAINCODE_FILE = 'example_cc.go'; | ||
|
||
// temporarily set $GOPATH to the test fixture folder | ||
module.exports.setupChaincodeDeploy = function() { | ||
var gopath = process.env.GOPATH; | ||
|
||
if (!gopath) { | ||
throw new Error('Environment variable $GOPATH must be set for the SDK to deploy chaincode'); | ||
} | ||
var src = path.join(__dirname, '../fixtures/example_cc.go'); | ||
|
||
var fullpath = path.join(gopath, 'src', module.exports.CHAINCODE_PATH); | ||
var target = path.join(fullpath, module.exports.CHAINCODE_FILE); | ||
|
||
fs.mkdirs(fullpath, function(err1) { | ||
if (err1) throw new Error(err1); | ||
|
||
fs.copy(src, target, function(err2) { | ||
if (err2) throw new Error(err2); | ||
|
||
return; | ||
}); | ||
|
||
}); | ||
process.env.GOPATH = path.join(__dirname, '../fixtures'); | ||
}; |