Modify CI
continuous-integration/drone/push Build is failing Details

main
Андрей Иванов 2024-09-11 10:43:52 +03:00
parent 052aa0aa16
commit 3b48952750
3 changed files with 0 additions and 287 deletions

View File

@ -1,59 +0,0 @@
package main
import (
"encoding/json"
"errors"
tnt15 "github.com/lomik/go-tnt"
"gitlab.corp.mail.ru/cloud/workdisk/libs.git/log"
"gitlab.corp.mail.ru/cloud/workdisk/libs.git/tarantool15"
"time"
)
type ProjectInfo struct {
IsPaidTariff *bool `json:"is_paid_tariff"`
Users uint32 `json:"users"`
FreezeAt *uint64 `json:"freeze_at"`
TariffEndTime *uint64 `json:"tariff_end_time"`
PID string `json:"id"`
Space uint64 `json:"space"`
Cost float64 `json:"cost"`
Status string `json:"status"`
}
func main() {
cli := tarantool15.NewPool(
"cloudbilling",
[]string{"localhost:3301"},
&tnt15.Options{
ConnectTimeout: 10 * time.Second,
QueryTimeout: 10 * time.Second,
}, nil, "cloudbiz")
cli.Start()
tuples, err := cli.CallARO("cloud_info", &tnt15.Call{
Name: tnt15.Bytes("cloudbilling.api"),
Tuple: tnt15.Tuple{
tnt15.Bytes("requestID"),
tnt15.Bytes("cloud_info"),
tnt15.Bytes("pid"),
tnt15.Bytes("2"),
},
})
if err != nil {
var tntErr tarantool15.Error
if !errors.As(err, &tntErr) || tntErr.Status != 404 {
log.WithError(err).Fatal("call cloudbilling with jeneric err")
}
}
log.
WithStringField("status", string(tuples[0][0])).
WithStringField("message", string(tuples[0][1])).
Infof("cloud_info response")
var response ProjectInfo
if err = json.Unmarshal(tuples[0][1], &response); err != nil {
log.WithError(err).Error("unmarshall response")
}
log.Infof("func response: %+v", response)
}

View File

@ -1,30 +0,0 @@
package main
import (
"flag"
"tests/jetcli/methods"
)
var (
method = flag.String("method", "", "biz method")
args = methods.Args{
URL: flag.String("url", "127.0.0.1:80", "jet address"),
AuthUser: flag.String("auth_user", "nobody", "jet user"),
AuthPassword: flag.String("auth_password", "nopass", "jet password"),
PID: flag.Uint64("pid", 0, "pid"),
Name: flag.String("name", "", "name"),
UID: flag.Uint64("uid", 0, "uid"),
Email: flag.String("email", "", "email"),
TreeID: flag.String("tree_id", "", "tree_id"),
Operation: flag.Uint64("operation", 0, "operation"),
Quota: flag.Uint64("quota", 0, "quota"),
Mode: flag.Uint64("mode", 0, "mode"),
ToSet: flag.String("to_set", "", "to_set"),
ToUnset: flag.String("to_unset", "", "to_unset"),
}
)
func main() {
flag.Parse()
methods.Call(method, args)
}

View File

@ -1,198 +0,0 @@
package methods
import (
"context"
"log"
"time"
"gitlab.corp.mail.ru/cloud/go/jet/pkg/configured"
"gitlab.corp.mail.ru/cloud/go/jet/pkg/jet"
)
type Args struct {
URL *string
AuthUser *string
AuthPassword *string
PID *uint64
Name *string
UID *uint64
Email *string
TreeID *string
Operation *uint64
Quota *uint64
Mode *uint64
ToSet *string
ToUnset *string
}
func Call(method *string, args Args) {
ctx := context.Background()
client := jet.New(configured.JetClientConfig{
URL: "http://" + *args.URL,
Timeout: 10 * time.Second,
BasicAuthCred: configured.BasicAuthConfig{
Username: *args.AuthUser,
Password: *args.AuthPassword,
},
})
switch *method {
case "project_register":
err := client.BizProjectRegister(ctx, "some_request_id", &jet.BizProjectRegisterRequest{
PID: *args.PID,
Name: *args.Name,
})
if err != nil {
log.Fatal(err.Error())
}
case "project_delete":
err := client.BizProjectDelete(ctx, "some_request_id", &jet.BizProjectDeleteRequest{
PID: *args.PID,
})
if err != nil {
log.Fatal(err.Error())
}
case "catalog_acl_ctl":
err := client.BizCatalogACLCtl(ctx, "some_request_id", &jet.BizCatalogACLCtlRequest{
PID: *args.PID,
TreeID: []byte(*args.TreeID),
UID: *args.UID,
Operation: uint8(*args.Operation),
})
if err != nil {
log.Fatal(err.Error())
}
case "catalog_acl_list":
resp, err := client.BizCatalogACLList(ctx, "some_request_id", &jet.BizCatalogACLListRequest{
PID: *args.PID,
TreeID: []byte(*args.TreeID),
})
if err != nil {
log.Fatal(err.Error())
}
log.Printf("Method response: %#v", resp)
case "catalog_create":
resp, err := client.BizCatalogCreate(ctx, "some_request_id", &jet.BizCatalogCreateRequest{
PID: *args.PID,
Name: *args.Name,
Quota: *args.Quota,
})
if err != nil {
log.Fatal(err.Error())
}
log.Printf("Method response: %#v", resp)
case "catalog_delete":
err := client.BizCatalogDelete(ctx, "some_request_id", &jet.BizCatalogDeleteRequest{
PID: *args.PID,
TreeID: []byte(*args.TreeID),
})
if err != nil {
log.Fatal(err.Error())
}
case "catalog_mount":
err := client.BizCatalogMount(ctx, "some_request_id", &jet.BizCatalogMountRequest{
PID: *args.PID,
TreeID: []byte(*args.TreeID),
UID: *args.UID,
Mode: uint8(*args.Mode),
})
if err != nil {
log.Fatal(err.Error())
}
case "catalog_umount":
err := client.BizCatalogUMount(ctx, "some_request_id", &jet.BizCatalogUMountRequest{
PID: *args.PID,
TreeID: []byte(*args.TreeID),
UID: *args.UID,
})
if err != nil {
log.Fatal(err.Error())
}
case "catalog_quota_set":
err := client.BizCatalogQuotaSet(ctx, "some_request_id", &jet.BizCatalogQuotaSetRequest{
PID: *args.PID,
TreeID: []byte(*args.TreeID),
Quota: *args.Quota,
})
if err != nil {
log.Fatal(err.Error())
}
case "user_register":
err := client.BizUserRegister(ctx, "some_request_id", &jet.BizUserRegisterRequest{
PID: *args.PID,
UID: *args.UID,
Email: *args.Email,
Quota: *args.Quota,
})
if err != nil {
log.Fatal(err.Error())
}
case "user_delete":
err := client.BizUserDelete(ctx, "some_request_id", &jet.BizUserRequest{
PID: *args.PID,
UID: *args.UID,
})
if err != nil {
log.Fatal(err.Error())
}
case "user_block":
err := client.BizUserBlock(ctx, "some_request_id", &jet.BizUserRequest{
PID: *args.PID,
UID: *args.UID,
})
if err != nil {
log.Fatal(err.Error())
}
case "user_unblock":
err := client.BizUserUnblock(ctx, "some_request_id", &jet.BizUserRequest{
PID: *args.PID,
UID: *args.UID,
})
if err != nil {
log.Fatal(err.Error())
}
case "user_flags_get":
resp, err := client.BizUserFlagsGet(ctx, "some_request_id", &jet.BizUserRequest{
PID: *args.PID,
UID: *args.UID,
})
if err != nil {
log.Fatal(err.Error())
}
log.Printf("Method response: %#v", resp)
case "user_flags_set":
resp, err := client.BizUserFlagsSet(ctx, "some_request_id", &jet.BizUserSetFlagsRequest{
PID: *args.PID,
UID: *args.UID,
ToSet: []string{*args.ToSet},
ToUnset: []string{*args.ToUnset},
})
if err != nil {
log.Fatal(err.Error())
}
log.Printf("Method response: %#v", resp)
case "user_quota_set":
resp, err := client.BizUserQuotaSet(ctx, "some_request_id", &jet.BizUserSetQuotaRequest{
PID: *args.PID,
UID: *args.UID,
Operation: uint8(*args.Operation),
Quota: *args.Quota,
})
if err != nil {
log.Fatal(err.Error())
}
log.Printf("Method response: %#v", resp)
case "user_du":
resp, err := client.BizUserDU(ctx, "some_request_id", &jet.BizUserRequest{
PID: *args.PID,
UID: *args.UID,
})
if err != nil {
log.Fatal(err.Error())
}
log.Printf("Method response: %#v", resp)
default:
log.Fatalf("unknown method: %s", *method)
}
log.Print("command applied successfully")
}