github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/store/etcdv3/processing_test.go (about) 1 package etcdv3 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/projecteru2/core/types" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestProcessing(t *testing.T) { 13 m := NewMercury(t) 14 ctx := context.Background() 15 processing := &types.Processing{ 16 Appname: "app", 17 Entryname: "entry", 18 Nodename: "node", 19 Ident: "abc", 20 } 21 22 // create 23 assert.NoError(t, m.CreateProcessing(ctx, processing, 10)) 24 // create again 25 assert.Error(t, m.CreateProcessing(ctx, processing, 10)) 26 assert.NoError(t, m.AddWorkload(ctx, &types.Workload{Name: "a_b_c"}, processing)) 27 28 nodeCount, err := m.doLoadProcessing(ctx, processing.Appname, processing.Entryname) 29 assert.NoError(t, err) 30 assert.Equal(t, nodeCount["node"], 9) 31 // delete 32 assert.NoError(t, m.DeleteProcessing(ctx, processing)) 33 }