server/service: Fix Missing Test Errors (#2196)

This fixes 9 places in the `server/service` tests where err variables were being dropped. No new test failures identified.
This commit is contained in:
Lars Lehtonen 2020-02-18 18:11:16 -08:00 committed by GitHub
parent 877cd7e39a
commit 96cbd10651
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 0 deletions

View file

@ -132,6 +132,7 @@ func TestLogin(t *testing.T) {
// ensure that our user's session was deleted from the store
sessions, err = ds.ListSessionsForUser(testUser.ID)
assert.Nil(t, err)
assert.Len(t, sessions, 0)
}
}

View file

@ -70,6 +70,7 @@ func TestSearchWithOmit(t *testing.T) {
Name: "label foo",
Query: "query foo",
})
require.Nil(t, err)
{
results, err := svc.SearchTargets(ctx, "foo", nil, nil)

View file

@ -25,6 +25,7 @@ func TestRotateLoggerSIGHUP(t *testing.T) {
defer os.Remove(f.Name())
logFile, err := logging.NewFilesystemLogWriter(f.Name(), log.NewNopLogger(), true)
require.Nil(t, err)
// write a log line
logFile.Write(ctx, []json.RawMessage{json.RawMessage("msg1")})

View file

@ -72,6 +72,7 @@ func TestModifyUserEmail(t *testing.T) {
return nil
}
svc, err := newTestService(ms, nil)
require.Nil(t, err)
ctx := context.Background()
ctx = viewer.NewContext(ctx, viewer.Viewer{User: user})
payload := kolide.UserPayload{
@ -107,6 +108,7 @@ func TestModifyUserCannotUpdateAdminEnabled(t *testing.T) {
return nil
}
svc, err := newTestService(ms, nil)
require.Nil(t, err)
ctx := context.Background()
ctx = viewer.NewContext(ctx, viewer.Viewer{User: user})
payload := kolide.UserPayload{
@ -148,6 +150,7 @@ func TestModifyUserEmailNoPassword(t *testing.T) {
return nil
}
svc, err := newTestService(ms, nil)
require.Nil(t, err)
ctx := context.Background()
ctx = viewer.NewContext(ctx, viewer.Viewer{User: user})
payload := kolide.UserPayload{
@ -195,6 +198,7 @@ func TestModifyAdminUserEmailNoPassword(t *testing.T) {
return nil
}
svc, err := newTestService(ms, nil)
require.Nil(t, err)
ctx := context.Background()
ctx = viewer.NewContext(ctx, viewer.Viewer{User: user})
payload := kolide.UserPayload{
@ -242,6 +246,7 @@ func TestModifyAdminUserEmailPassword(t *testing.T) {
return nil
}
svc, err := newTestService(ms, nil)
require.Nil(t, err)
ctx := context.Background()
ctx = viewer.NewContext(ctx, viewer.Viewer{User: user})
payload := kolide.UserPayload{
@ -674,6 +679,7 @@ func TestPerformRequiredPasswordReset(t *testing.T) {
session, err := ds.NewSession(&kolide.Session{
UserID: user.ID,
})
require.Nil(t, err)
ctx = viewer.NewContext(ctx, viewer.Viewer{User: user, Session: session})
// should error when reset not required