go18/devcloud/mpaas/apps/application/impl/application_test.go

39 lines
1.0 KiB
Go
Raw Normal View History

2025-06-22 15:14:10 +08:00
package impl_test
import (
"testing"
"122.51.31.227/go-course/go18/devcloud/mpaas/apps/application"
)
func TestCreateApplication(t *testing.T) {
req := application.NewCreateApplicationRequest()
req.Name = "devcloud"
req.Description = "应用研发云"
req.Type = application.TYPE_SOURCE_CODE
req.CodeRepository = application.CodeRepository{
2025-07-06 08:43:20 +08:00
SshUrl: "git@122.51.31.227:go-course/go17.git",
2025-06-22 15:14:10 +08:00
}
2025-06-29 15:26:49 +08:00
req.SetNamespaceId(1)
2025-07-06 08:43:20 +08:00
req.SetLabel("team", "dev01.backend_developer")
2025-06-22 15:14:10 +08:00
ins, err := svc.CreateApplication(ctx, req)
if err != nil {
t.Fatal(err)
}
t.Log(ins)
}
2025-06-22 16:29:42 +08:00
// SELECT * FROM `applications` WHERE (NOT JSON_EXTRACT(`label`,'$.team') IS NOT NULL OR JSON_EXTRACT(`label`,'$.team') = 'golang_dev_group_01') ORDER BY created_at desc LIMIT 20
func TestQueryApplication(t *testing.T) {
req := application.NewQueryApplicationRequest()
2025-06-29 10:24:46 +08:00
// dev01.%
2025-07-06 08:43:20 +08:00
req.SetNamespaceId(1)
2025-06-29 15:26:49 +08:00
req.SetScope("team", []string{"dev01%"})
2025-06-22 16:29:42 +08:00
// req.SetScope("env", []string{"prod"})
ins, err := svc.QueryApplication(ctx, req)
if err != nil {
t.Fatal(err)
}
t.Log(ins)
}