Skip to content

Commit

Permalink
grpc: change port numbers used in test and hope for the best
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed90 committed Aug 21, 2019
1 parent c658672 commit 657a709
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions grpc/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ func TestServer(t *testing.T) {
app.Config.UsernameIsEmail = true

// run against a real database if the test isn't run with -test.short flag
if !testing.Short() {
app = setup(t, logger)
}
// if !testing.Short() {
// app = setup(t, logger)
// }

// start a fake oauth provider
providerServer := httptest.NewServer(test.ProviderApp())
Expand All @@ -154,7 +154,11 @@ func TestServer(t *testing.T) {

ctx, cancel := context.WithCancel(context.Background())
go Server(ctx, app)
defer cancel()
defer func() {
cancel()

time.Sleep(time.Second * 2)
}()

// to use with REST API
jar, err := cookiejar.New(nil)
Expand Down Expand Up @@ -632,13 +636,13 @@ func TestRESTInterface(t *testing.T) {

// The ports are hardcoded because the Server() function blackboxes our
// access to the listeners, so we can't get their address dynamically.
testApp.Config.PublicPort = 8080
testApp.Config.ServerPort = 9090
testApp.Config.PublicPort = 8181
testApp.Config.ServerPort = 9191

// run against a real database if the test isn't run with -test.short flag
if !testing.Short() {
testApp = setup(t, logger)
}
// if !testing.Short() {
// testApp = setup(t, logger)
// }

// parent context for servers
ctx := context.Background()
Expand Down Expand Up @@ -1500,13 +1504,13 @@ func TestGRPCInterface(t *testing.T) {

// The ports are hardcoded because the Server() function blackboxes our
// access to the listeners, so we can't get their address dynamically.
testApp.Config.PublicPort = 8080
testApp.Config.ServerPort = 9090
testApp.Config.PublicPort = 8282
testApp.Config.ServerPort = 9292

// run against a real database if the test isn't run with -test.short flag
if !testing.Short() {
testApp = setup(t, logger)
}
// if !testing.Short() {
// testApp = setup(t, logger)
// }

// We still want the username to be an email for testing purposes
testApp.Config.UsernameIsEmail = true
Expand Down

0 comments on commit 657a709

Please sign in to comment.