Yeuoly 1 년 전
부모
커밋
42c8451fe2
2개의 변경된 파일36개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      internal/cluster/clutser_test.go
  2. 31 0
      internal/cluster/plugin_test.go

+ 5 - 0
internal/cluster/clutser_test.go

@@ -27,6 +27,11 @@ func createSimulationCluster(nums int) ([]*Cluster, error) {
 
 	routine.InitPool(1024)
 
+	// delete master key
+	if err := cache.Del(PREEMPTION_LOCK_KEY); err != nil {
+		return nil, err
+	}
+
 	return result, nil
 }
 

+ 31 - 0
internal/cluster/plugin_test.go

@@ -0,0 +1,31 @@
+package cluster
+
+import (
+	"time"
+
+	"github.com/google/uuid"
+	"github.com/langgenius/dify-plugin-daemon/internal/types/entities"
+	"github.com/langgenius/dify-plugin-daemon/internal/types/entities/plugin_entities"
+)
+
+func getRandomPluginRuntime() entities.PluginRuntime {
+	return entities.PluginRuntime{
+		Config: plugin_entities.PluginDeclaration{
+			Name:      uuid.New().String(),
+			Version:   "0.0.1",
+			Type:      plugin_entities.PluginType,
+			Author:    "Yeuoly",
+			CreatedAt: time.Now(),
+			Plugins:   []string{"test"},
+		},
+	}
+}
+
+// func TestPluginScheduleLifetime(t *testing.T) {
+// 	plugin := getRandomPluginRuntime()
+// 	cluster, err := createSimulationCluster(1)
+// 	if err != nil {
+// 		t.Errorf("create simulation cluster failed: %v", err)
+// 		return
+// 	}
+// }