Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ccaas_builder/cmd/detect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ func main() {
logger.Printf("::Error: %v\n", err)
os.Exit(1)
}

logger.Printf("::Type detected as ccaas")
}

type chaincodeMetadata struct {
Expand Down Expand Up @@ -59,10 +57,12 @@ func run() error {
return errors.WithMessage(err, "Unable to parse the metadata.json file")
}

if strings.ToLower(metadata.Type) != "ccaas" {
if strings.ToLower(metadata.Type) != "ccaas" && strings.ToLower(metadata.Type) != "remote" {
return fmt.Errorf("chaincode type not supported: %s", metadata.Type)
}

logger.Printf("::Type detected as: " + strings.ToLower(metadata.Type))

// returning nil indicates to the peer a successful detection
return nil
}
4 changes: 4 additions & 0 deletions ccaas_builder/cmd/detect/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func TestArugments(t *testing.T) {
exitCode: 0,
args: []string{"na", "testdata/validtype"},
},
"validremote": {
exitCode: 0,
args: []string{"na", "testdata/validremote"},
},
"wrongtype": {
exitCode: 1,
args: []string{"na", "testdata/wrongtype"},
Expand Down
4 changes: 4 additions & 0 deletions ccaas_builder/cmd/detect/testdata/validremote/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "remote",
"label": "audit-trail"
}
Loading