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

Function TestGitlabPlugin

backend/test/e2e/manual/gitlab/gitlab_test.go:39–164  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37const pluginName = "gitlab"
38
39func TestGitlabPlugin(t *testing.T) {
40 createConnection := func(cfg TestConfig, client *helper.DevlakeClient) *helper.Connection {
41 conn := pluginmodels.GitlabConnection{
42 BaseConnection: api.BaseConnection{
43 Name: "gitlab-conn",
44 },
45 GitlabConn: pluginmodels.GitlabConn{
46 RestConnection: api.RestConnection{
47 Endpoint: "https://gitlab.com/api/v4",
48 Proxy: "",
49 RateLimitPerHour: 0,
50 },
51 AccessToken: api.AccessToken{Token: cfg.Token},
52 },
53 }
54 client.TestConnection(pluginName, conn)
55 return client.CreateConnection(pluginName, conn)
56 }
57 client := helper.ConnectLocalServer(t, &helper.LocalClientConfig{
58 ServerPort: 8089,
59 DbURL: config.GetConfig().GetString("E2E_DB_URL"),
60 CreateServer: true,
61 DropDb: false,
62 TruncateDb: true,
63 Plugins: []plugin.PluginMeta{
64 gitlab.Gitlab{},
65 gitextractor.GitExtractor{},
66 },
67 })
68 cfg := helper.GetTestConfig[TestConfig]()
69 connection := createConnection(cfg, client)
70 t.Run("blueprint v200", func(t *testing.T) {
71 scopeConfig := helper.Cast[pluginmodels.GitlabScopeConfig](client.CreateScopeConfig("gitlab", connection.ID,
72 pluginmodels.GitlabScopeConfig{
73 ScopeConfig: common.ScopeConfig{
74 Entities: []string{
75 plugin.DOMAIN_TYPE_CICD,
76 plugin.DOMAIN_TYPE_CODE,
77 plugin.DOMAIN_TYPE_CODE_REVIEW,
78 },
79 Name: "config-1",
80 },
81 PrType: "",
82 PrComponent: "",
83 PrBodyClosePattern: "",
84 IssueSeverity: "",
85 IssuePriority: "",
86 IssueComponent: "",
87 IssueTypeBug: "",
88 IssueTypeIncident: "",
89 IssueTypeRequirement: "",
90 DeploymentPattern: ".*",
91 ProductionPattern: ".*", // this triggers dora
92 Refdiff: nil, // this is technically a true/false (nil or not)
93 }))
94 _ = scopeConfig
95 remoteScopes := client.RemoteScopes(helper.RemoteScopesQuery{
96 PluginName: pluginName,

Callers

nothing calls this directly

Calls 15

CreateConnectionMethod · 0.80
GetStringMethod · 0.80
RunMethod · 0.80
CreateScopeConfigMethod · 0.80
RemoteScopesMethod · 0.80
CreateScopesMethod · 0.80
CreateProjectMethod · 0.80
ListProjectsMethod · 0.80
GetProjectMethod · 0.80
TriggerBlueprintMethod · 0.80
SetExpectedStatusCodeMethod · 0.80

Tested by

no test coverage detected