Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

I cannot running the test #361

Open
cyberwave opened this issue Jul 13, 2020 · 11 comments
Open

I cannot running the test #361

cyberwave opened this issue Jul 13, 2020 · 11 comments

Comments

@cyberwave
Copy link

cyberwave commented Jul 13, 2020

While i follow the Readme.md step by step:

  1. make bddtests
  2. cd test/bddtests/fixtures/
  3. docker-compose up –force-recreate(may be this command is docker-compose up --force-recreate)
  4. cd test/bddtests
  5. DISABLE_COMPOSITION=true go test
    while exec the first command, the fabric network is up, then it down and test failed with:

.INFO[0040] Executing fabric-cli command with args [ledgerconfig update --configfile ./fixtures/config/fabric/mychannel-consortium-config.json --noprompt]
[test-logger] 2020/07/13 08:02:59 UTC - bddtests.Resolve -> INFO Resolving vars for ledgerconfig
[test-logger] 2020/07/13 08:02:59 UTC - bddtests.Resolve -> INFO Resolving vars for update
[test-logger] 2020/07/13 08:02:59 UTC - bddtests.Resolve -> INFO Resolving vars for --configfile
[test-logger] 2020/07/13 08:02:59 UTC - bddtests.Resolve -> INFO Resolving vars for ./fixtures/config/fabric/mychannel-consortium-config.json
[test-logger] 2020/07/13 08:02:59 UTC - bddtests.Resolve -> INFO Resolving vars for --noprompt
INFO[0040] Executing fabric-cli with args: [ledgerconfig update --configfile ./fixtures/config/fabric/mychannel-consortium-config.json --noprompt] ...
INFO[0070] ... got response:
F----- 23

--- Failed steps:

Scenario: Invalid configuration # features/blockchain-handler.feature:263
And fabric-cli is executed with args "ledgerconfig update --configfile ./fixtures/config/fabric/mychannel-consortium-config.json --noprompt" # features/blockchain-handler.feature:36
Error: Error: Transaction processing for endorser [localhost:8151]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [localhost:8151]: waiting for connection failed: context deadline exceeded

github.com/trustbloc/sidetree-fabric/test/bddtests.(*FabricCLI).Exec
/Users/great/goproj/src/github.com/trustbloc/sidetree-fabric/test/bddtests/fabriccli.go:51
github.com/trustbloc/sidetree-fabric/test/bddtests.(*FabricCLISteps).execute
/Users/great/goproj/src/github.com/trustbloc/sidetree-fabric/test/bddtests/fabriccli_steps.go:89
reflect.Value.call
/usr/local/go/src/reflect/value.go:460
reflect.Value.Call
/usr/local/go/src/reflect/value.go:321
github.com/cucumber/godog.(*StepDef).run
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/stepdef.go:201
github.com/cucumber/godog.(*Suite).runStep
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/suite.go:350
github.com/cucumber/godog.(*Suite).runSteps
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/suite.go:435
github.com/cucumber/godog.(*Suite).runScenario
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/suite.go:638
github.com/cucumber/godog.(*Suite).runFeature
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/suite.go:607
github.com/cucumber/godog.(*Suite).run
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/suite.go:267
github.com/cucumber/godog.(*runner).run
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/run.go:118
github.com/cucumber/godog.RunWithOptions
/Users/great/goproj/pkg/mod/github.com/cucumber/[email protected]/run.go:215
github.com/trustbloc/sidetree-fabric/test/bddtests.TestMain
/Users/great/goproj/src/github.com/trustbloc/sidetree-fabric/test/bddtests/bddtests_test.go:47
main.main
_testmain.go:40
runtime.main
/usr/local/go/src/runtime/proc.go:203
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1373

3 scenarios (2 passed, 1 failed)
23 steps (17 passed, 1 failed, 5 skipped)
1m10.420150656s

Randomized with seed: 1594627339517076000
testing: warning: no tests to run

and when i running DISABLE_COMPOSITION=true go test ,and on the other terminal run docker logs -f peer1.org2.example.com, i find a error of:

Failed to load ledger mychannel(LedgerID does not exist

and the log txt with context is:

2020-07-13 07:59:24.046 UTC [fsblkstorage] preResetHtFiles -> INFO 046 No active channels passed
2020-07-13 07:59:24.046 UTC [ext_authfilter] get -> INFO 047 Auth filter not registered: [DefaultAuth]
2020-07-13 07:59:24.046 UTC [ext_authfilter] get -> INFO 048 Auth filter not registered: [ExpirationCheck]
2020-07-13 08:02:22.395 UTC [peer] InitializeChannel -> INFO 049 Loading chain mychannel
2020-07-13 08:02:22.395 UTC [ledgermgmt] OpenLedger -> INFO 04a Opening ledger with id = mychannel
2020-07-13 08:02:22.416 UTC [peer] InitializeChannel -> ERRO 04b Failed to load ledger mychannel(LedgerID does not exist
github.com/hyperledger/fabric/core/ledger/kvledger.init
/Users/great/goproj/pkg/mod/github.com/trustbloc/[email protected]/core/ledger/kvledger/kv_ledger_provider.go:34
runtime.doInit
/usr/local/go/src/runtime/proc.go:5414
runtime.doInit
/usr/local/go/src/runtime/proc.go:5409
runtime.doInit
/usr/local/go/src/runtime/proc.go:5409
runtime.doInit
/usr/local/go/src/runtime/proc.go:5409
runtime.doInit
/usr/local/go/src/runtime/proc.go:5409
runtime.doInit
/usr/local/go/src/runtime/proc.go:5409
runtime.doInit
/usr/local/go/src/runtime/proc.go:5409
runtime.main
/usr/local/go/src/runtime/proc.go:190
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1373)
2020-07-13 08:02:22.417 UTC [ext_cscc] func2 -> INFO 04c Got error initializing channel [mychannel] on attempt 1. Will retry in 375ms: LedgerID does not exist
2020-07-13 08:02:22.792 UTC [peer] InitializeChannel -> INFO 04d Loading chain mychannel
2020-07-13 08:02:22.792 UTC [ledgermgmt] OpenLedger -> INFO 04e Opening ledger with id = mychannel

what should i do or wether the readme.md is the latest?
ps: i cannot download the image of docker.pkg.github.com/trustbloc/sidetree-fabric/peer:latest,and the image of i use is exec make fabric-peer-docker

@bstasyszyn
Copy link
Contributor

Can you try building the image:

make clean populate-fixtures docker-thirdparty fabric-peer-docker build-cc fabric-cli

And then run the test manually. If that doesn't work then delete all of you docker images and retry the above.

@bstasyszyn
Copy link
Contributor

The latest sidetree-fabric image in docker is: docker.pkg.github.com/trustbloc-cicd/snapshot/peer:amd64-0.1.4-snapshot-50fc7cd

@cyberwave
Copy link
Author

cyberwave commented Jul 14, 2020

The latest sidetree-fabric image in docker is: docker.pkg.github.com/trustbloc-cicd/snapshot/peer:amd64-0.1.4-snapshot-50fc7cd

This image looks like it's in a private repository, the error info follow the command docker pull docker.pkg.github.com/trustbloc-cicd/snapshot/peer:amd64-0.1.4-snapshot-50fc7cd
is

Error response from daemon: Get https://docker.pkg.github.com/v2/trustbloc-cicd/snapshot/peer/manifests/amd64-0.1.4-snapshot-50fc7cd: no basic auth credentials

The image I am currently using is manually compiled, but it doesnot work

@llorllale
Copy link

@cyberwave

The latest sidetree-fabric image in docker is: docker.pkg.github.com/trustbloc-cicd/snapshot/peer:amd64-0.1.4-snapshot-50fc7cd

This image looks like it's in a private repository, the error info follow the command docker pull docker.pkg.github.com/trustbloc-cicd/snapshot/peer:amd64-0.1.4-snapshot-50fc7cd
is

Error response from daemon: Get https://docker.pkg.github.com/v2/trustbloc-cicd/snapshot/peer/manifests/amd64-0.1.4-snapshot-50fc7cd: no basic auth credentials

The image I am currently using is manually compiled, but it doesnot work

Make sure you've authenticated to github's docker hub.

@cyberwave
Copy link
Author

@cyberwave

The latest sidetree-fabric image in docker is: docker.pkg.github.com/trustbloc-cicd/snapshot/peer:amd64-0.1.4-snapshot-50fc7cd

This image looks like it's in a private repository, the error info follow the command docker pull docker.pkg.github.com/trustbloc-cicd/snapshot/peer:amd64-0.1.4-snapshot-50fc7cd
is

Error response from daemon: Get https://docker.pkg.github.com/v2/trustbloc-cicd/snapshot/peer/manifests/amd64-0.1.4-snapshot-50fc7cd: no basic auth credentials

The image I am currently using is manually compiled, but it doesnot work

Make sure you've authenticated to github's docker hub.

the docker.pkg.github.com have no entry for register or i cannot find it! when i type "https://docker.pkg.github.com/" in the search of browser and get "{"status": "ok", "message": "Hello, world! This is the GitHub Package Registry."}"。

I use the Makefile buid a image and use docker-compose can running,but the bddtests seem like doesnot work normal!

@llorllale
Copy link

@cyberwave

the docker.pkg.github.com have no entry for register or i cannot find it! when i type "https://docker.pkg.github.com/" in the search of browser and get "{"status": "ok", "message": "Hello, world! This is the GitHub Package Registry."}"。

See this

@cyberwave
Copy link
Author

cyberwave commented Jul 15, 2020

Now i pull the image docker.pkg.github.com/trustbloc/sidetree-fabric/peer:amd64-0.1.4-snapshot-e27249e according to the page of https://github.com/trustbloc/sidetree-fabric/packages

and the follow the README.md to run test, the error doesn't missing,

--- Failed steps:

Scenario: Attempt to access the blockchain endpoints without providing an auth token # features/blockchain-handler.feature:264
And fabric-cli is executed with args "ledgerconfig update --configfile ./fixtures/config/fabric/mychannel-org2-config.json --noprompt" # features/blockchain-handler.feature:38
Error: Error: error getting peers from discovery service for channel [mychannel]: error calling discover service send: Multiple errors occurred: - From target: localhost:8051: could not connect to localhost:8051: dialing connection on target [localhost:8051]: waiting for connection failed: context deadline exceeded - From target: localhost:8251: could not connect to localhost:8251: dialing connection on target [localhost:8251]: waiting for connection failed: context deadline exceeded

and use command line,all is ok

PROJECT_PATH=../.. ../../.build/bin/fabric --home .fabriccli ledgerconfig update --configfile ./fixtures/config/fabric/mychannel-org1-config.json --noprompt
Configuration successfully updated!
~/goproj/src/github.com/trustbloc/sidetree-fabric/test/bddtests @e27249e8 *6 !4  PROJECT_PATH=../.. ../../.build/bin/fabric --home .fabriccli ledgerconfig update --configfile ./fixtures/config/fabric/mychannel-org2-config.json --noprompt
Configuration successfully updated!

what the test result on you envionment? does my result is normal?

@cyberwave
Copy link
Author

cyberwave commented Jul 15, 2020

I change some code in sidetree-fabric/test/bddtests/fabriccli_steps.go L80 func (d *FabricCLISteps) execute(strArgs string) error and to fix the error contains context deadline exceeded

--- a/test/bddtests/fabriccli_steps.go
+++ b/test/bddtests/fabriccli_steps.go
@@ -9,6 +9,7 @@ package bddtests
 import (
        "os"
        "strings"
+       "time"
 
        "github.com/cucumber/godog"
        "github.com/pkg/errors"
@@ -86,13 +87,23 @@ func (d *FabricCLISteps) execute(strArgs string) error {
                return err
        }
        logger.Infof("Executing fabric-cli with args: %s ...", args)
-       response, err := NewFabricCLI().Exec(args...)
-       logger.Infof("... got response: %s", response)
-       if err != nil {
-               return err
+       for i := 0; i < 5; i++ {
+               response, err := NewFabricCLI().Exec(args...)
+               logger.Infof("... got response: %s", response)
+               if err != nil {
+                       if strings.Contains(err.Error(), "context deadline exceeded") {
+                               logger.Errorf("exec failed,err:%s\n current %d times,sleep 10 second, and then try again!", err.Error(), i)
+                               time.Sleep(10 * time.Second)
+                               continue
+                       } else {
+                               logger.Errorf("failed exec,err:%s", err.Error())
+                               return err
+                       }
+               }
+               bddtests.SetResponse(response)
+               break
        }
 
-       bddtests.SetResponse(response)
        return nil
 }

and got a new error:

--- Failed steps:

Scenario: Invalid configuration # features/blockchain-handler.feature:260
When fabric-cli is executed with args "ledgerconfig update --configfile ./fixtures/config/fabric/invalid-blockchainhandler-config.json --noprompt" # features/blockchain-handler.feature:262
Error: Error: Multiple errors occurred: - Transaction processing for endorser [localhost:7251]: Chaincode status Code: (500) UNKNOWN. Description: Error saving config: validation error: invalid component name [/sidetree/0.0.1/invalid] - component name must be set to the base path [/sidetree/0.0.1/blockchain] for (MSP:Org1MSP),(Peer:peer0.org1.example.com),(AppName:blockchain-handler),(AppVersion:1),(Comp:/sidetree/0.0.1/invalid),(CompVersion:0.1.3) - Transaction processing for endorser [localhost:8151]: Chaincode status Code: (500) UNKNOWN. Description: Error saving config: validation error: invalid component name [/sidetree/0.0.1/invalid] - component name must be set to the base path [/sidetree/0.0.1/blockchain] for (MSP:Org1MSP),(Peer:peer0.org1.example.com),(AppName:blockchain-handler),(AppVersion:1),(Comp:/sidetree/0.0.1/invalid),(CompVersion:0.1.3)

the feature is :

@invalid_blockchain_config
Scenario: Invalid configuration
Given fabric-cli context "mychannel" is used
When fabric-cli is executed with args "ledgerconfig update --configfile ./fixtures/config/fabric/invalid-blockchainhandler-config.json --noprompt" then the error response should contain "component name must be set to the base path [/sidetree/0.0.1/blockchain]"

focus on the error and feature! the error contains "component name must be set to the base path [/sidetree/0.0.1/blockchain]" but the test interrupt!

@bjwswang
Copy link

@llorllale what kind of scopes need to be configured in git personal access token ?

@llorllale
Copy link

@bjwswang read:packages should be enough

@DavidCasalod
Copy link

Hi, I have a similar problem, when running "make bddtests" I got:

3 scenarios (2 passed, 1 failed)
25 steps (9 passed, 1 failed, 15 skipped)
39.517799215s

Randomized with seed: 1636016261258709224
testing: warning: no tests to run
PASS
coverage: 8.8% of statements
FAIL github.com/trustbloc/sidetree-fabric/test/bddtests 39.540s
FAIL
make: *** [Makefile:99: bddtests] Error 1_

Do you know if it continues to work or is deprecated?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants