github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/store/redis/processing_test.go (about)

     1  package redis
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/projecteru2/core/types"
     7  )
     8  
     9  func (s *RediaronTestSuite) TestProcessing() {
    10  	ctx := context.Background()
    11  	processing := &types.Processing{
    12  		Appname:   "app",
    13  		Entryname: "entry",
    14  		Ident:     "abc",
    15  		Nodename:  "node",
    16  	}
    17  
    18  	// create
    19  	s.NoError(s.rediaron.CreateProcessing(ctx, processing, 10))
    20  	// create again
    21  	s.Error(s.rediaron.CreateProcessing(ctx, processing, 10))
    22  	s.NoError(s.rediaron.AddWorkload(ctx, &types.Workload{Name: "a_b_c"}, processing))
    23  
    24  	nodeCount, err := s.rediaron.doLoadProcessing(ctx, processing.Appname, processing.Entryname)
    25  	s.NoError(err)
    26  	s.Equal(nodeCount["node"], 9)
    27  	// delete
    28  	s.NoError(s.rediaron.DeleteProcessing(ctx, processing))
    29  }