MCPcopy
hub / github.com/apache/devlake / TestTestmoPlugin

Function TestTestmoPlugin

backend/test/e2e/manual/testmo/testmo_test.go:37–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35const pluginName = "testmo"
36
37func TestTestmoPlugin(t *testing.T) {
38 cfg := helper.GetTestConfig[TestConfig]()
39
40 // Disable remote plugins to avoid poetry dependency
41 config.GetConfig().Set("DISABLED_REMOTE_PLUGINS", true)
42
43 client := helper.ConnectLocalServer(t, &helper.LocalClientConfig{
44 ServerPort: 8089,
45 DbURL: config.GetConfig().GetString("E2E_DB_URL"),
46 CreateServer: true,
47 DropDb: true, // Use fresh database for each test run
48 TruncateDb: true,
49 Plugins: []plugin.PluginMeta{
50 &impl.Testmo{},
51 },
52 })
53 client.SetTimeout(0)
54 client.SetPipelineTimeout(0)
55 connection := createConnection(cfg, client)
56 t.Run("blueprint v200", func(t *testing.T) {
57 projectScopes := helper.RemoteScopesOutput{}
58 var scopeData []any
59 for {
60 projectScopes = client.RemoteScopes(helper.RemoteScopesQuery{
61 PluginName: pluginName,
62 ConnectionId: connection.ID,
63 PageToken: projectScopes.NextPageToken,
64 Params: nil,
65 })
66 for _, remoteScope := range projectScopes.Children {
67 if remoteScope.Type == "scope" {
68 data := helper.Cast[pluginmodels.TestmoProject](remoteScope.Data)
69 for _, projectName := range cfg.Projects {
70 if projectName == data.Name {
71 scopeData = append(scopeData, &data)
72 }
73 }
74 }
75 }
76 if projectScopes.NextPageToken == "" {
77 break
78 }
79 }
80 createdScopes := helper.Cast[[]*pluginmodels.TestmoProject](client.CreateScopes(pluginName, connection.ID, scopeData...))
81 require.True(t, len(createdScopes) > 0)
82
83 projectName := fmt.Sprintf("testmo-project-%s-%s", pluginName, "unique")
84
85 outputProject := client.CreateProject(&helper.ProjectConfig{
86 ProjectName: projectName,
87 EnableDora: true,
88 })
89
90 // Delete any existing blueprints for this project
91 if outputProject.Blueprint != nil {
92 client.DeleteBlueprint(outputProject.Blueprint.ID)
93 }
94

Callers

nothing calls this directly

Calls 15

GetStringMethod · 0.80
SetPipelineTimeoutMethod · 0.80
RunMethod · 0.80
RemoteScopesMethod · 0.80
CreateScopesMethod · 0.80
CreateProjectMethod · 0.80
GetProjectMethod · 0.80
TriggerBlueprintMethod · 0.80
SetExpectedStatusCodeMethod · 0.80
createConnectionFunction · 0.70
GetConfigMethod · 0.65

Tested by

no test coverage detected