Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
chore: Point to latest sidetree-core-go
Browse files Browse the repository at this point in the history
closes #96

Signed-off-by: Bob Stasyszyn <[email protected]>
  • Loading branch information
bstasyszyn committed Jan 24, 2020
1 parent db45a09 commit 8d19e3f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ ifneq ($(strip $(DEV_IMAGES)),)
endif


generate-test-keys: clean
generate-test-keys:
@mkdir -p -p test/bddtests/fixtures/keys/tls
@docker run -i --rm \
-v $(abspath .):/opt/go/src/github.com/trustbloc/sidetree-mock \
--entrypoint "/opt/go/src/github.com/trustbloc/sidetree-mock/scripts/generate_test_keys.sh" \
frapsoft/openssl

bddtests: clean checks generate-test-keys sidetree-docker
bddtests: generate-test-keys sidetree-docker
@scripts/integration.sh

clean:
Expand Down
7 changes: 4 additions & 3 deletions cmd/sidetree-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import (
var logger = logrus.New()
var config = viper.New()

const didDocNamespace = "did:sidetree:"
const didDocNamespace = "did:sidetree"
const basePath = "/document"

func main() {
config.SetEnvPrefix("SIDETREE_MOCK")
Expand Down Expand Up @@ -68,8 +69,8 @@ func main() {

restSvc := httpserver.New(
getListenURL(),
diddochandler.NewUpdateHandler(didDocHandler),
diddochandler.NewResolveHandler(didDocHandler),
diddochandler.NewUpdateHandler(basePath, didDocHandler),
diddochandler.NewResolveHandler(basePath, didDocHandler),
)

if restSvc.Start() != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/sirupsen/logrus v1.3.0
github.com/spf13/viper v1.3.2
github.com/stretchr/testify v1.4.0
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200121184334-e7f75df77702
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200124183623-a98ad9da837b
)

go 1.13
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200121184334-e7f75df77702 h1:stCjK0gqzexuutI3Lxd/WGxUuacqlKgX+q1vE41sBnc=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200121184334-e7f75df77702/go.mod h1:FC7RAK7yPS2Y7iKQL2gt01fVi1JtYLbpUklNYcxCfYQ=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200124183623-a98ad9da837b h1:TcTBqWPQmV7dV0JtRzMP5Hx6Hj+kasZ79jf6EWdOOhg=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200124183623-a98ad9da837b/go.mod h1:FC7RAK7yPS2Y7iKQL2gt01fVi1JtYLbpUklNYcxCfYQ=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8 h1:gZfMjx7Jr6N8b7iJO4eUjDsn6xJqoyXg8D+ogdoAfKY=
Expand Down
18 changes: 10 additions & 8 deletions pkg/httpserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/trustbloc/sidetree-core-go/pkg/docutil"
"github.com/trustbloc/sidetree-core-go/pkg/mocks"
"github.com/trustbloc/sidetree-core-go/pkg/restapi/common"
"github.com/trustbloc/sidetree-core-go/pkg/restapi/diddochandler"
Expand All @@ -28,12 +29,13 @@ const (
url = "localhost:8080"
clientURL = "http://" + url

didDocNamespace = "did:sidetree:"
didID = didDocNamespace + "EiDOQXC2GnoVyHwIRbjhLx_cNc6vmZaS04SZjZdlLLAPRg=="
didDocNamespace = "did:sidetree"
basePath = "/document"
didID = didDocNamespace + docutil.NamespaceDelimiter + "EiDOQXC2GnoVyHwIRbjhLx_cNc6vmZaS04SZjZdlLLAPRg=="

sampleNamespace = "sample:sidetree:"
sampleNamespace = "sample:sidetree"
samplePath = "/sample"
sampleID = sampleNamespace + "EiDOQXC2GnoVyHwIRbjhLx_cNc6vmZaS04SZjZdlLLAPRg=="
sampleID = sampleNamespace + docutil.NamespaceDelimiter + "EiDOQXC2GnoVyHwIRbjhLx_cNc6vmZaS04SZjZdlLLAPRg=="

createRequest = `{
"header": {
Expand All @@ -52,8 +54,8 @@ func TestServer_Start(t *testing.T) {
sampleDocHandler := mocks.NewMockDocumentHandler().WithNamespace(sampleNamespace)

s := New(url,
diddochandler.NewUpdateHandler(didDocHandler),
diddochandler.NewResolveHandler(didDocHandler),
diddochandler.NewUpdateHandler(basePath, didDocHandler),
diddochandler.NewResolveHandler(basePath, didDocHandler),
newSampleUpdateHandler(sampleDocHandler),
newSampleResolveHandler(sampleDocHandler),
)
Expand All @@ -68,15 +70,15 @@ func TestServer_Start(t *testing.T) {
err := json.Unmarshal([]byte(createRequest), request)
require.NoError(t, err)

resp, err := httpPut(t, clientURL+diddochandler.Path, request)
resp, err := httpPut(t, clientURL+basePath, request)
require.NoError(t, err)
require.NotNil(t, resp)
doc := make(map[string]interface{})
require.NoError(t, json.Unmarshal(resp, &doc))
require.Equal(t, didID, doc["id"])
})
t.Run("Resolve DID doc", func(t *testing.T) {
resp, err := httpGet(t, clientURL+diddochandler.Path+"/"+didID)
resp, err := httpGet(t, clientURL+basePath+"/"+didID)
require.NoError(t, err)
require.NotNil(t, resp)
doc := make(map[string]interface{})
Expand Down
4 changes: 2 additions & 2 deletions test/bddtests/did_sidetree_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
var logger = logrus.New()

const sha2256 = 18
const didDocNamespace = "did:sidetree:"
const didDocNamespace = "did:sidetree"
const testDocumentURL = "http://localhost:48326/document"
const initialValuesParam = ";initial-values="

Expand Down Expand Up @@ -61,7 +61,7 @@ func (d *DIDSideSteps) resolveDIDDocumentWithID(didDocumentPath, didID string) e
logger.Infof("resolve did document %s with initial value %s", didDocumentPath, didID)

d.reqEncodedDIDDoc = encodeDidDocument(didDocumentPath, didID)
d.resp, err = restclient.SendResolveRequest(testDocumentURL + "/" + didDocNamespace + didID + initialValuesParam + d.reqEncodedDIDDoc)
d.resp, err = restclient.SendResolveRequest(testDocumentURL + "/" + didDocNamespace + docutil.NamespaceDelimiter + didID + initialValuesParam + d.reqEncodedDIDDoc)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion test/bddtests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/fsouza/go-dockerclient v1.3.0
github.com/pkg/errors v0.8.1
github.com/sirupsen/logrus v1.3.0
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200121184334-e7f75df77702
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200124183623-a98ad9da837b
)

go 1.13
4 changes: 2 additions & 2 deletions test/bddtests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200121184334-e7f75df77702 h1:stCjK0gqzexuutI3Lxd/WGxUuacqlKgX+q1vE41sBnc=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200121184334-e7f75df77702/go.mod h1:FC7RAK7yPS2Y7iKQL2gt01fVi1JtYLbpUklNYcxCfYQ=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200124183623-a98ad9da837b h1:TcTBqWPQmV7dV0JtRzMP5Hx6Hj+kasZ79jf6EWdOOhg=
github.com/trustbloc/sidetree-core-go v0.1.1-0.20200124183623-a98ad9da837b/go.mod h1:FC7RAK7yPS2Y7iKQL2gt01fVi1JtYLbpUklNYcxCfYQ=
github.com/vishvananda/netlink v1.0.0 h1:bqNY2lgheFIu1meHUFSH3d7vG93AFyqg3oGbJCOJgSM=
github.com/vishvananda/netlink v1.0.0/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc h1:R83G5ikgLMxrBvLh22JhdfI8K6YXEPHx5P03Uu3DRs4=
Expand Down

0 comments on commit 8d19e3f

Please sign in to comment.