@@ -29,14 +29,13 @@ import (
29
29
)
30
30
31
31
func TestMain (m * testing.M ) {
32
- flag .BoolVar (& runTests , "run-controller-tests" , false , "run tests" )
32
+ flag .BoolVar (& runTests , "run-controller-tests" , true , "run tests" )
33
33
flag .Parse ()
34
34
testutil .SetupTestConfig ()
35
35
os .Exit (m .Run ())
36
36
}
37
37
38
38
func TestVM_ListImages (t * testing.T ) {
39
- t .Skip ("No need to invoke list images." )
40
39
vm , err := NewVM ()
41
40
if err != nil {
42
41
t .Fail ()
@@ -84,14 +83,27 @@ func TestVM_GetChaincodePackageBytes(t *testing.T) {
84
83
assert .Error (t , err ,
85
84
"GetChaincodePackageBytes did not return error when chaincode spec is nil" )
86
85
87
- spec := & pb.ChaincodeSpec {Type : pb .ChaincodeSpec_GOLANG ,
86
+ spec := & pb.ChaincodeSpec {ChaincodeId : nil }
87
+ _ , err = GetChaincodePackageBytes (spec )
88
+ assert .Error (t , err , "Error expected when GetChaincodePackageBytes is called with nil chaincode ID" )
89
+ assert .Contains (t , err .Error (), "invalid chaincode spec" )
90
+
91
+ spec = & pb.ChaincodeSpec {Type : pb .ChaincodeSpec_GOLANG ,
88
92
ChaincodeId : nil ,
89
93
Input : & pb.ChaincodeInput {Args : util .ToChaincodeArgs ("f" )}}
90
94
_ , err = GetChaincodePackageBytes (spec )
91
95
assert .Error (t , err ,
92
96
"GetChaincodePackageBytes did not return error when chaincode ID is nil" )
93
97
}
94
98
99
+ func TestVM_BuildChaincodeContainer (t * testing.T ) {
100
+ vm , err := NewVM ()
101
+ assert .NoError (t , err )
102
+ err = vm .BuildChaincodeContainer (nil )
103
+ assert .Error (t , err )
104
+ assert .Contains (t , err .Error (), "Error getting chaincode package bytes" )
105
+ }
106
+
95
107
func TestVM_Chaincode_Compile (t * testing.T ) {
96
108
// vm, err := NewVM()
97
109
// if err != nil {
0 commit comments