Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelreiswildlife committed Jun 17, 2024
1 parent fdb17db commit 6aa50e4
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions e2e/apns_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (s *ApnsE2ETestSuite) SetupSuite() {
}

func (s *ApnsE2ETestSuite) setupApnsPusher() (
string,
*pusher.APNSPusher,
*mocks.MockAPNSPushQueue,
*mocks.MockStatsDClient,
Expand Down Expand Up @@ -72,11 +73,11 @@ func (s *ApnsE2ETestSuite) setupApnsPusher() (
apnsPusher, err := pusher.NewAPNSPusher(false, s.vConfig, s.config, logger, statsdClientMock, nil, mockApnsClient)
s.Require().NoError(err)

return apnsPusher, mockApnsClient, statsdClientMock, responsesChannel
return appName, apnsPusher, mockApnsClient, statsdClientMock, responsesChannel
}

func (s *ApnsE2ETestSuite) TestSimpleNotification() {
p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
app, p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
go p.Start(context.Background())
time.Sleep(wait)

Expand All @@ -85,7 +86,6 @@ func (s *ApnsE2ETestSuite) TestSimpleNotification() {
})
s.Require().NoError(err)

app := s.config.GetApnsAppsArray()[0]
topic := "push-" + app + "_apns-single"
token := "token"
testDone := make(chan bool)
Expand Down Expand Up @@ -146,7 +146,7 @@ func (s *ApnsE2ETestSuite) TestSimpleNotification() {
}

func (s *ApnsE2ETestSuite) TestNotificationRetry() {
p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
app, p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
go p.Start(context.Background())
time.Sleep(wait)

Expand All @@ -155,7 +155,6 @@ func (s *ApnsE2ETestSuite) TestNotificationRetry() {
})
s.Require().NoError(err)

app := s.config.GetApnsAppsArray()[0]
topic := "push-" + app + "_apns-single"
token := "token"
done := make(chan bool)
Expand Down Expand Up @@ -236,7 +235,7 @@ func (s *ApnsE2ETestSuite) TestNotificationRetry() {
}

func (s *ApnsE2ETestSuite) TestRetryLimit() {
p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
app, p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
go p.Start(context.Background())
time.Sleep(wait)

Expand All @@ -245,7 +244,6 @@ func (s *ApnsE2ETestSuite) TestRetryLimit() {
})
s.Require().NoError(err)

app := s.config.GetApnsAppsArray()[0]
topic := "push-" + app + "_apns-single"
token := "token"
done := make(chan bool)
Expand Down Expand Up @@ -309,7 +307,7 @@ func (s *ApnsE2ETestSuite) TestRetryLimit() {
}

func (s *ApnsE2ETestSuite) TestMultipleNotifications() {
p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
app, p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
go p.Start(context.Background())
time.Sleep(wait)

Expand All @@ -319,7 +317,6 @@ func (s *ApnsE2ETestSuite) TestMultipleNotifications() {
})
s.Require().NoError(err)

app := s.config.GetApnsAppsArray()[0]
topic := fmt.Sprintf(apnsTopicTemplate, app)
token := "token"
done := make(chan bool)
Expand Down Expand Up @@ -390,7 +387,7 @@ func (s *ApnsE2ETestSuite) TestMultipleNotifications() {
func (s *ApnsE2ETestSuite) TestConsumeMessagesBeforeExiting() {
s.vConfig.Set("gracefulShutdownTimeout", 10*time.Second)

p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
app, p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
go p.Start(ctx)
Expand All @@ -402,7 +399,6 @@ func (s *ApnsE2ETestSuite) TestConsumeMessagesBeforeExiting() {
})
s.Require().NoError(err)

app := s.config.GetApnsAppsArray()[0]
topic := fmt.Sprintf(apnsTopicTemplate, app)
token := "token"
done := make(chan bool)
Expand Down Expand Up @@ -481,7 +477,7 @@ func (s *ApnsE2ETestSuite) TestConsumeMessagesBeforeExiting() {
func (s *ApnsE2ETestSuite) TestConsumeMessagesBeforeExitingWithRetries() {
s.vConfig.Set("gracefulShutdownTimeout", 10*time.Second)

p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
app, p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
go p.Start(ctx)
Expand All @@ -492,7 +488,6 @@ func (s *ApnsE2ETestSuite) TestConsumeMessagesBeforeExitingWithRetries() {
})
s.Require().NoError(err)

app := s.config.GetApnsAppsArray()[0]
topic := fmt.Sprintf(apnsTopicTemplate, app)
token := "token"
done := make(chan bool)
Expand Down

0 comments on commit 6aa50e4

Please sign in to comment.