Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
all: fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Jul 21, 2018
1 parent 4058ede commit 4e21873
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
19 changes: 19 additions & 0 deletions integration-test/gortcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
version: "1.1"

server:
check_fingerprint: true
listen:
- 0.0.0.0:3478
realm: realm

auth:
public: false

nonce:
static: false
timeout: 600s

static:
- username: username
password: secret
3 changes: 3 additions & 0 deletions integration-test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ func main() {
if err := res.Parse(&nonce, &realm); err != nil {
logger.Fatal("failed to get nonce and realm")
}
logger.Info("integrity",
zap.Stringer("nonce", nonce), zap.Stringer("realm", realm), zap.String("password", password),
)
integrity := stun.NewLongTermIntegrity(username.String(), realm.String(), password)
// Constructing allocate request with integrity
if err := do(logger, req, res, c,
Expand Down
2 changes: 2 additions & 0 deletions integration-test/server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ WORKDIR /go/src/github.com/gortc/gortcd

RUN go install .

COPY integration-test/gortcd.yml .

CMD ["gortcd"]

2 changes: 1 addition & 1 deletion internal/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func normalize(address string) string {

type staticCredElem struct {
Username string `mapstructure:"username"`
Password string `mapstructure:"username"`
Password string `mapstructure:"password"`
Key string `mapstructure:"key"`
Realm string `mapstructure:"realm"`
}
Expand Down
5 changes: 3 additions & 2 deletions internal/server/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ func TestServerIntegration(t *testing.T) {
t.Fatal(err)
}
s, err := New(Options{
Log: logger.Named("server"),
Conn: serverConn,
Log: logger.Named("server"),
Conn: serverConn,
Realm: "realm",
Auth: auth.NewStatic([]auth.StaticCredential{
{Username: "username", Password: "secret", Realm: "realm"},
}),
Expand Down
3 changes: 1 addition & 2 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ func (s *Server) needAuth(ctx *context) bool {
}

var (
realm = stun.NewRealm("realm")
defaultNonce = stun.NewNonce("nonce")
)

Expand All @@ -337,7 +336,7 @@ func (s *Server) process(ctx *context) error {
return nil
}
ctx.software = software
ctx.realm = realm
ctx.realm = s.realm
ctx.nonce = defaultNonce
if ce := s.log.Check(zapcore.InfoLevel, "got message"); ce != nil {
ce.Write(zap.Stringer("m", ctx.request), zap.Stringer("addr", ctx.client))
Expand Down

0 comments on commit 4e21873

Please sign in to comment.