terminate a canceled session when its last connection is closed. (#520)

This commit is contained in:
Jim authored and GitHub committed 2020-10-02 10:01:46 -04:00
1 parent ecbff200e3
commit bd547fd0d6
3 files changed
+190 -5

No files matched your search

+6 -3
View File
@@ -892,13 +892,16 @@ func TestRepository_TerminateCompletedSessions(t *testing.T) {
return
}
assert.NoError(err)
assert.Equal(len(args.wantTermed), got)
t.Logf("terminated: %d", got)
var foundTerminated int
for _, ses := range args.sessions {
found, _, err := repo.LookupSession(context.Background(), ses.PublicId)
require.NoError(err)
_, shouldBeTerminated := args.wantTermed[found.PublicId]
if shouldBeTerminated {
if found.TerminationReason != "" {
foundTerminated += 1
}
assert.Equal(args.wantTermed[found.PublicId].String(), found.TerminationReason)
t.Logf("terminated %s has a connection limit of %d", found.PublicId, found.ConnectionLimit)
conn, err := repo.ListConnections(context.Background(), found.PublicId)
@@ -925,7 +928,7 @@ func TestRepository_TerminateCompletedSessions(t *testing.T) {
}
}
}
assert.Equal(len(args.wantTermed), foundTerminated)
})
}
}