Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe committed Apr 19, 2024
1 parent c125ca0 commit f381558
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions impl/internal/did/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/anacrolix/dht/v2/bep44"
"github.com/goccy/go-json"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -42,6 +43,21 @@ func TestClient(t *testing.T) {
t.Logf("time to put and get: %s", since)
}

func TestGet(t *testing.T) {
client, err := NewGatewayClient("https://diddht-staging.tbd.engineering")
require.NoError(t, err)
require.NotNil(t, client)

did, types, gateways, err := client.GetDIDDocument("did:dht:ijy37zs6sudo4d73h6c4pecbuaxzohontmtfuk3338fp3ogqm73y")
assert.NoError(t, err)
assert.NotEmpty(t, did)
assert.Empty(t, types)
assert.Empty(t, gateways)

b, _ := json.Marshal(did)
println(string(b))
}

func TestClientInvalidGateway(t *testing.T) {
g, err := NewGatewayClient("\n")
assert.Error(t, err)
Expand Down
2 changes: 1 addition & 1 deletion impl/pkg/service/pkarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (s *PkarrService) republish() {
defer cancel()

if _, putErr := s.dht.Put(putCtx, record.BEP44()); putErr != nil {
logrus.WithContext(putCtx).WithError(putErr).Debugf("failed to republish record: %s", recordID)
logrus.WithContext(putCtx).WithError(putErr).Warnf("failed to republish record: %s", recordID)
atomic.AddInt32(&batchErrCnt, 1)
} else {
atomic.AddInt32(&batchSuccessCnt, 1)
Expand Down

0 comments on commit f381558

Please sign in to comment.