feat(master): store update jobs (#7)
This commit is contained in:
@@ -160,3 +160,36 @@ func TestListServices_SwarmLast(t *testing.T) {
|
||||
}
|
||||
|
||||
func itoa(n int64) string { return strconv.FormatInt(n, 10) }
|
||||
|
||||
func TestGetService_IncludesRemoved(t *testing.T) {
|
||||
s := openTestStore(t)
|
||||
ctx := context.Background()
|
||||
id := newAgent(t, s, "node-2")
|
||||
require.NoError(t, s.ApplySnapshot(ctx, id, worker, []protocol.Service{slusk}, t0))
|
||||
svcs, err := s.ListServices(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, svcs, 1)
|
||||
|
||||
require.NoError(t, s.RemoveService(ctx, id, "", slusk.Key(), t0))
|
||||
got, err := s.GetService(ctx, svcs[0].ID)
|
||||
require.NoError(t, err)
|
||||
assert.NotNil(t, got.RemovedAt)
|
||||
assert.Equal(t, "node-2", got.AgentName)
|
||||
|
||||
_, err = s.GetService(ctx, 99999)
|
||||
assert.ErrorIs(t, err, model.ErrNotFound)
|
||||
}
|
||||
|
||||
func TestApplySnapshot_StoresConfigFiles(t *testing.T) {
|
||||
s := openTestStore(t)
|
||||
ctx := context.Background()
|
||||
id := newAgent(t, s, "node-2")
|
||||
withFiles := slusk
|
||||
withFiles.ConfigFiles = "/srv/slusk/compose.yaml,/srv/slusk/compose.override.yaml"
|
||||
require.NoError(t, s.ApplySnapshot(ctx, id, worker, []protocol.Service{withFiles}, t0))
|
||||
|
||||
got, err := s.ListServices(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, got, 1)
|
||||
assert.Equal(t, withFiles.ConfigFiles, got[0].ConfigFiles)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user