separate server run bindings from deployment targets
This commit is contained in:
@@ -32,6 +32,31 @@ func TestCoreServiceRegistersNewRunControlSession(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreServiceDoesNotRevokeSharedLegacyRunEndpoint(t *testing.T) {
|
||||
svc := newTestCoreService()
|
||||
plugin, endpoint := createPluginAndRunEndpoint(t, svc)
|
||||
hello := validRunControlHello()
|
||||
hello.CapabilityReport.Capabilities = append(hello.CapabilityReport.Capabilities, plugin.RequiredRunCapabilities...)
|
||||
registered, err := svc.RegisterRunHello(hello)
|
||||
if err != nil || !registered.Accepted {
|
||||
t.Fatalf("register shared endpoint: result=%+v err=%v", registered, err)
|
||||
}
|
||||
first, err := svc.CreateServerInstance(domain.ServerInstance{ID: "shared-first", PluginID: plugin.ID, RunEndpointID: endpoint.ID, Name: "Shared First", State: domain.ServerInstanceStateReady})
|
||||
if err != nil {
|
||||
t.Fatalf("create first legacy server: %v", err)
|
||||
}
|
||||
if _, err := svc.CreateServerInstance(domain.ServerInstance{ID: "shared-second", PluginID: plugin.ID, RunEndpointID: endpoint.ID, Name: "Shared Second", State: domain.ServerInstanceStateReady}); err != nil {
|
||||
t.Fatalf("create second legacy server: %v", err)
|
||||
}
|
||||
if err := svc.revokeRunControlSessionForInstance(first); err != nil {
|
||||
t.Fatalf("revoke first legacy Run: %v", err)
|
||||
}
|
||||
session, err := svc.store.RunControlSessions().Get(endpoint.ID)
|
||||
if err != nil || session.Status != domain.AuthSessionStatusActive {
|
||||
t.Fatalf("shared legacy endpoint session must remain active, session=%+v err=%v", session, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreServiceReRegistersExistingRunEndpoint(t *testing.T) {
|
||||
svc := newTestCoreService()
|
||||
first, err := svc.RegisterRunHello(validRunControlHello())
|
||||
|
||||
Reference in New Issue
Block a user