From 9564a27098214add24f69f8bcfd86d90f56ae483 Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Wed, 16 Nov 2022 10:29:20 +0000 Subject: [PATCH 1/2] [common-go] Move db models to common-go --- components/common-go/BUILD.yaml | 10 +- components/common-go/db/conn.go | 2 +- .../pkg => common-go}/db/cost_center.go | 49 +++--- .../pkg => common-go}/db/cost_center_test.go | 47 +++--- .../pkg => common-go}/db/dbtest/conn.go | 6 +- .../db/dbtest/cost_center.go | 9 +- .../db/dbtest/stripe_customer.go | 5 +- .../pkg => common-go}/db/dbtest/usage.go | 5 +- .../pkg => common-go}/db/dbtest/user.go | 14 +- .../pkg => common-go}/db/dbtest/workspace.go | 5 +- .../db/dbtest/workspace_instance.go | 13 +- .../{usage/pkg => common-go}/db/errors.go | 0 .../{usage/pkg => common-go}/db/order.go | 0 .../{usage/pkg => common-go}/db/project.go | 5 +- .../pkg => common-go}/db/project_test.go | 4 +- .../pkg => common-go}/db/stripe_customer.go | 9 +- .../db/stripe_customer_test.go | 11 +- .../{usage/pkg => common-go}/db/team.go | 5 +- .../pkg => common-go}/db/team_membership.go | 3 +- .../db/team_membership_test.go | 4 +- components/common-go/db/types.go | 2 +- components/common-go/db/types_test.go | 2 +- .../{usage/pkg => common-go}/db/usage.go | 23 ++- .../{usage/pkg => common-go}/db/usage_test.go | 33 ++-- .../pkg => common-go}/db/varchar_test.go | 12 +- .../{usage/pkg => common-go}/db/workspace.go | 9 +- .../db/workspace_instance.go | 27 ++-- .../db/workspace_instance_test.go | 105 ++++--------- .../pkg => common-go}/db/workspace_test.go | 9 +- components/common-go/go.mod | 4 +- components/common-go/go.sum | 143 +++++++++++++++++- components/content-service/go.mod | 2 +- components/content-service/go.sum | 6 +- components/supervisor/go.mod | 2 +- components/supervisor/go.sum | 5 +- components/usage/BUILD.yaml | 8 +- components/usage/go.mod | 2 +- components/usage/go.sum | 14 +- components/usage/pkg/apiv1/billing.go | 9 +- components/usage/pkg/apiv1/billing_test.go | 4 +- components/usage/pkg/apiv1/pricer.go | 2 +- components/usage/pkg/apiv1/pricer_test.go | 48 ++++++ components/usage/pkg/apiv1/usage.go | 13 +- components/usage/pkg/apiv1/usage_test.go | 35 +++-- components/usage/pkg/server/server.go | 5 +- components/usage/pkg/stripe/stripe.go | 2 +- components/usage/pkg/stripe/stripe_test.go | 3 +- install/installer/go.mod | 2 +- install/installer/go.sum | 14 +- .../pkg/components/usage/configmap.go | 2 +- .../config/v1/experimental/experimental.go | 2 +- 51 files changed, 438 insertions(+), 317 deletions(-) rename components/{usage/pkg => common-go}/db/cost_center.go (84%) rename components/{usage/pkg => common-go}/db/cost_center_test.go (91%) rename components/{usage/pkg => common-go}/db/dbtest/conn.go (80%) rename components/{usage/pkg => common-go}/db/dbtest/cost_center.go (83%) rename components/{usage/pkg => common-go}/db/dbtest/stripe_customer.go (89%) rename components/{usage/pkg => common-go}/db/dbtest/usage.go (92%) rename components/{usage/pkg => common-go}/db/dbtest/user.go (73%) rename components/{usage/pkg => common-go}/db/dbtest/workspace.go (99%) rename components/{usage/pkg => common-go}/db/dbtest/workspace_instance.go (92%) rename components/{usage/pkg => common-go}/db/errors.go (100%) rename components/{usage/pkg => common-go}/db/order.go (100%) rename components/{usage/pkg => common-go}/db/project.go (81%) rename components/{usage/pkg => common-go}/db/project_test.go (95%) rename components/{usage/pkg => common-go}/db/stripe_customer.go (82%) rename components/{usage/pkg => common-go}/db/stripe_customer_test.go (88%) rename components/{usage/pkg => common-go}/db/team.go (73%) rename components/{usage/pkg => common-go}/db/team_membership.go (91%) rename components/{usage/pkg => common-go}/db/team_membership_test.go (96%) rename components/{usage/pkg => common-go}/db/usage.go (83%) rename components/{usage/pkg => common-go}/db/usage_test.go (89%) rename components/{usage/pkg => common-go}/db/varchar_test.go (79%) rename components/{usage/pkg => common-go}/db/workspace.go (85%) rename components/{usage/pkg => common-go}/db/workspace_instance.go (88%) rename components/{usage/pkg => common-go}/db/workspace_instance_test.go (57%) rename components/{usage/pkg => common-go}/db/workspace_test.go (85%) diff --git a/components/common-go/BUILD.yaml b/components/common-go/BUILD.yaml index 3004b689df8cb6..33a768172659bc 100644 --- a/components/common-go/BUILD.yaml +++ b/components/common-go/BUILD.yaml @@ -7,5 +7,13 @@ packages: type: go srcs: - "**" + deps: + - :init-testdb config: - packaging: library \ No newline at end of file + packaging: library + + - name: init-testdb + type: generic + deps: + - components/gitpod-db:dbtest-init + ephemeral: true diff --git a/components/common-go/db/conn.go b/components/common-go/db/conn.go index b0417ad9d1a4d0..af04ab61d824c9 100644 --- a/components/common-go/db/conn.go +++ b/components/common-go/db/conn.go @@ -2,7 +2,7 @@ // Licensed under the GNU Affero General Public License (AGPL). // See License-AGPL.txt in the project root for license information. -package common_db +package db import ( "fmt" diff --git a/components/usage/pkg/db/cost_center.go b/components/common-go/db/cost_center.go similarity index 84% rename from components/usage/pkg/db/cost_center.go rename to components/common-go/db/cost_center.go index 45b1be024da1b7..56759c8f05924f 100644 --- a/components/usage/pkg/db/cost_center.go +++ b/components/common-go/db/cost_center.go @@ -10,7 +10,6 @@ import ( "fmt" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/log" "github.com/google/uuid" "google.golang.org/grpc/codes" @@ -28,13 +27,13 @@ const ( ) type CostCenter struct { - ID AttributionID `gorm:"primary_key;column:id;type:char;size:36;" json:"id"` - CreationTime common_db.VarcharTime `gorm:"primary_key;column:creationTime;type:varchar;size:255;" json:"creationTime"` - SpendingLimit int32 `gorm:"column:spendingLimit;type:int;default:0;" json:"spendingLimit"` - BillingStrategy BillingStrategy `gorm:"column:billingStrategy;type:varchar;size:255;" json:"billingStrategy"` - BillingCycleStart common_db.VarcharTime `gorm:"column:billingCycleStart;type:varchar;size:255;" json:"billingCycleStart"` - NextBillingTime common_db.VarcharTime `gorm:"column:nextBillingTime;type:varchar;size:255;" json:"nextBillingTime"` - LastModified time.Time `gorm:"->;column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` + ID AttributionID `gorm:"primary_key;column:id;type:char;size:36;" json:"id"` + CreationTime VarcharTime `gorm:"primary_key;column:creationTime;type:varchar;size:255;" json:"creationTime"` + SpendingLimit int32 `gorm:"column:spendingLimit;type:int;default:0;" json:"spendingLimit"` + BillingStrategy BillingStrategy `gorm:"column:billingStrategy;type:varchar;size:255;" json:"billingStrategy"` + BillingCycleStart VarcharTime `gorm:"column:billingCycleStart;type:varchar;size:255;" json:"billingCycleStart"` + NextBillingTime VarcharTime `gorm:"column:nextBillingTime;type:varchar;size:255;" json:"nextBillingTime"` + LastModified time.Time `gorm:"->;column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` } // TableName sets the insert table name for this struct type @@ -84,11 +83,11 @@ func (c *CostCenterManager) GetOrCreateCostCenter(ctx context.Context, attributi } result = CostCenter{ ID: attributionID, - CreationTime: common_db.NewVarCharTime(now), + CreationTime: NewVarCharTime(now), BillingStrategy: CostCenter_Other, SpendingLimit: defaultSpendingLimit, - BillingCycleStart: common_db.NewVarCharTime(now), - NextBillingTime: common_db.NewVarCharTime(now.AddDate(0, 1, 0)), + BillingCycleStart: NewVarCharTime(now), + NextBillingTime: NewVarCharTime(now.AddDate(0, 1, 0)), } err := c.conn.Save(&result).Error if err != nil { @@ -147,7 +146,7 @@ func (c *CostCenterManager) UpdateCostCenter(ctx context.Context, newCC CostCent now := time.Now() // we always update the creationTime - newCC.CreationTime = common_db.NewVarCharTime(now) + newCC.CreationTime = NewVarCharTime(now) // we don't allow setting billingCycleStart or nextBillingTime from outside newCC.BillingCycleStart = existingCC.BillingCycleStart newCC.NextBillingTime = existingCC.NextBillingTime @@ -173,9 +172,9 @@ func (c *CostCenterManager) UpdateCostCenter(ctx context.Context, newCC CostCent // Downgrading from stripe if existingCC.BillingStrategy == CostCenter_Stripe && newCC.BillingStrategy == CostCenter_Other { newCC.SpendingLimit = c.cfg.ForUsers - newCC.BillingCycleStart = common_db.NewVarCharTime(now) + newCC.BillingCycleStart = NewVarCharTime(now) // see you next month - newCC.NextBillingTime = common_db.NewVarCharTime(now.AddDate(0, 1, 0)) + newCC.NextBillingTime = NewVarCharTime(now.AddDate(0, 1, 0)) } // Upgrading to Stripe @@ -185,9 +184,9 @@ func (c *CostCenterManager) UpdateCostCenter(ctx context.Context, newCC CostCent return CostCenter{}, err } - newCC.BillingCycleStart = common_db.NewVarCharTime(now) + newCC.BillingCycleStart = NewVarCharTime(now) // set an informative nextBillingTime, even though we don't manage Stripe billing cycle - newCC.NextBillingTime = common_db.NewVarCharTime(now.AddDate(0, 1, 0)) + newCC.NextBillingTime = NewVarCharTime(now.AddDate(0, 1, 0)) } } else if isTeam { // Billing strategy is Other, and it remains unchanged @@ -201,9 +200,9 @@ func (c *CostCenterManager) UpdateCostCenter(ctx context.Context, newCC CostCent // Downgrading from stripe if existingCC.BillingStrategy == CostCenter_Stripe && newCC.BillingStrategy == CostCenter_Other { newCC.SpendingLimit = c.cfg.ForTeams - newCC.BillingCycleStart = common_db.NewVarCharTime(now) + newCC.BillingCycleStart = NewVarCharTime(now) // see you next month - newCC.NextBillingTime = common_db.NewVarCharTime(now.AddDate(0, 1, 0)) + newCC.NextBillingTime = NewVarCharTime(now.AddDate(0, 1, 0)) } // Upgrading to Stripe @@ -213,9 +212,9 @@ func (c *CostCenterManager) UpdateCostCenter(ctx context.Context, newCC CostCent return CostCenter{}, err } - newCC.BillingCycleStart = common_db.NewVarCharTime(now) + newCC.BillingCycleStart = NewVarCharTime(now) // set an informative nextBillingTime, even though we don't manage Stripe billing cycle - newCC.NextBillingTime = common_db.NewVarCharTime(now.AddDate(0, 1, 0)) + newCC.NextBillingTime = NewVarCharTime(now.AddDate(0, 1, 0)) } } else { return CostCenter{}, status.Errorf(codes.InvalidArgument, "Unknown attribution entity %s", string(attributionID)) @@ -260,7 +259,7 @@ func (c *CostCenterManager) NewInvoiceUsageRecord(ctx context.Context, attributi AttributionID: attributionID, Description: "Credits", CreditCents: creditCents * -1, - EffectiveTime: common_db.NewVarCharTime(now), + EffectiveTime: NewVarCharTime(now), Kind: InvoiceUsageKind, Draft: false, }, nil @@ -283,7 +282,7 @@ func (c *CostCenterManager) ListLatestCostCentersWithBillingTimeBefore(ctx conte Joins("INNER JOIN (?) AS expiredCC on cc.id = expiredCC.id AND cc.creationTime = expiredCC.creationTime", subquery). Where("cc.billingStrategy = ?", strategy). Where("nextBillingTime != ?", ""). - Where("nextBillingTime < ?", common_db.TimeToISO8601(billingTimeBefore)). + Where("nextBillingTime < ?", TimeToISO8601(billingTimeBefore)). FindInBatches(&batch, 1000, func(tx *gorm.DB, iteration int) error { results = append(results, batch...) return nil @@ -336,9 +335,9 @@ func (c *CostCenterManager) ResetUsage(ctx context.Context, cc CostCenter) (Cost ID: cc.ID, SpendingLimit: spendingLimit, BillingStrategy: cc.BillingStrategy, - BillingCycleStart: common_db.NewVarCharTime(now), - NextBillingTime: common_db.NewVarCharTime(nextBillingTime), - CreationTime: common_db.NewVarCharTime(now), + BillingCycleStart: NewVarCharTime(now), + NextBillingTime: NewVarCharTime(nextBillingTime), + CreationTime: NewVarCharTime(now), } err = c.conn.Save(&newCostCenter).Error if err != nil { diff --git a/components/usage/pkg/db/cost_center_test.go b/components/common-go/db/cost_center_test.go similarity index 91% rename from components/usage/pkg/db/cost_center_test.go rename to components/common-go/db/cost_center_test.go index cc410a9eef2bc5..9a1d38d96f1096 100644 --- a/components/usage/pkg/db/cost_center_test.go +++ b/components/common-go/db/cost_center_test.go @@ -9,9 +9,8 @@ import ( "testing" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -73,28 +72,28 @@ func TestCostCenterManager_GetOrCreateCostCenter_ResetsExpired(t *testing.T) { expiredCC := db.CostCenter{ ID: db.NewTeamAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(now), + CreationTime: db.NewVarCharTime(now), SpendingLimit: 0, BillingStrategy: db.CostCenter_Other, - NextBillingTime: common_db.NewVarCharTime(expired), - BillingCycleStart: common_db.NewVarCharTime(now), + NextBillingTime: db.NewVarCharTime(expired), + BillingCycleStart: db.NewVarCharTime(now), } unexpiredCC := db.CostCenter{ ID: db.NewUserAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(now), + CreationTime: db.NewVarCharTime(now), SpendingLimit: 500, BillingStrategy: db.CostCenter_Other, - NextBillingTime: common_db.NewVarCharTime(unexpired), - BillingCycleStart: common_db.NewVarCharTime(now), + NextBillingTime: db.NewVarCharTime(unexpired), + BillingCycleStart: db.NewVarCharTime(now), } // Stripe billing strategy should not be reset stripeCC := db.CostCenter{ ID: db.NewUserAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(now), + CreationTime: db.NewVarCharTime(now), SpendingLimit: 0, BillingStrategy: db.CostCenter_Stripe, - NextBillingTime: common_db.VarcharTime{}, - BillingCycleStart: common_db.NewVarCharTime(now), + NextBillingTime: db.VarcharTime{}, + BillingCycleStart: db.NewVarCharTime(now), } dbtest.CreateCostCenters(t, conn, @@ -109,7 +108,7 @@ func TestCostCenterManager_GetOrCreateCostCenter_ResetsExpired(t *testing.T) { t.Cleanup(func() { conn.Model(&db.CostCenter{}).Delete(retrievedExpiredCC.ID) }) - require.Equal(t, common_db.NewVarCharTime(expired).Time().AddDate(0, 1, 0), retrievedExpiredCC.NextBillingTime.Time()) + require.Equal(t, db.NewVarCharTime(expired).Time().AddDate(0, 1, 0), retrievedExpiredCC.NextBillingTime.Time()) require.Equal(t, expiredCC.ID, retrievedExpiredCC.ID) require.Equal(t, expiredCC.BillingStrategy, retrievedExpiredCC.BillingStrategy) require.WithinDuration(t, now, expiredCC.CreationTime.Time(), 3*time.Second, "new cost center creation time must be within 3 seconds of now") @@ -117,7 +116,7 @@ func TestCostCenterManager_GetOrCreateCostCenter_ResetsExpired(t *testing.T) { // unexpired cost center must not be reset retrievedUnexpiredCC, err := mnr.GetOrCreateCostCenter(context.Background(), unexpiredCC.ID) require.NoError(t, err) - require.Equal(t, common_db.NewVarCharTime(unexpired).Time(), retrievedUnexpiredCC.NextBillingTime.Time()) + require.Equal(t, db.NewVarCharTime(unexpired).Time(), retrievedUnexpiredCC.NextBillingTime.Time()) require.Equal(t, unexpiredCC.ID, retrievedUnexpiredCC.ID) require.Equal(t, unexpiredCC.BillingStrategy, retrievedUnexpiredCC.BillingStrategy) require.WithinDuration(t, unexpiredCC.CreationTime.Time(), retrievedUnexpiredCC.CreationTime.Time(), 100*time.Millisecond) @@ -349,16 +348,16 @@ func TestCostCenter_ListLatestCostCentersWithBillingTimeBefore(t *testing.T) { dbtest.NewCostCenter(t, db.CostCenter{ ID: db.NewTeamAttributionID(attributionID), SpendingLimit: 100, - CreationTime: common_db.NewVarCharTime(firstCreation), + CreationTime: db.NewVarCharTime(firstCreation), BillingStrategy: db.CostCenter_Other, - NextBillingTime: common_db.NewVarCharTime(firstCreation), + NextBillingTime: db.NewVarCharTime(firstCreation), }), dbtest.NewCostCenter(t, db.CostCenter{ ID: db.NewTeamAttributionID(attributionID), SpendingLimit: 100, - CreationTime: common_db.NewVarCharTime(secondCreation), + CreationTime: db.NewVarCharTime(secondCreation), BillingStrategy: db.CostCenter_Other, - NextBillingTime: common_db.NewVarCharTime(secondCreation), + NextBillingTime: db.NewVarCharTime(secondCreation), }), } @@ -386,14 +385,14 @@ func TestCostCenter_ListLatestCostCentersWithBillingTimeBefore(t *testing.T) { dbtest.NewCostCenter(t, db.CostCenter{ ID: db.NewTeamAttributionID(attributionID), SpendingLimit: 100, - CreationTime: common_db.NewVarCharTime(firstCreation), + CreationTime: db.NewVarCharTime(firstCreation), BillingStrategy: db.CostCenter_Other, - NextBillingTime: common_db.NewVarCharTime(firstCreation), + NextBillingTime: db.NewVarCharTime(firstCreation), }), dbtest.NewCostCenter(t, db.CostCenter{ ID: db.NewTeamAttributionID(attributionID), SpendingLimit: 100, - CreationTime: common_db.NewVarCharTime(secondCreation), + CreationTime: db.NewVarCharTime(secondCreation), BillingStrategy: db.CostCenter_Stripe, }), } @@ -418,7 +417,7 @@ func TestCostCenterManager_ResetUsage(t *testing.T) { }) _, err := mnr.ResetUsage(context.Background(), db.CostCenter{ ID: db.NewUserAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(time.Now()), + CreationTime: db.NewVarCharTime(time.Now()), SpendingLimit: 500, BillingStrategy: db.CostCenter_Stripe, }) @@ -433,10 +432,10 @@ func TestCostCenterManager_ResetUsage(t *testing.T) { }) oldCC := db.CostCenter{ ID: db.NewTeamAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(time.Now()), + CreationTime: db.NewVarCharTime(time.Now()), SpendingLimit: 0, BillingStrategy: db.CostCenter_Other, - NextBillingTime: common_db.NewVarCharTime(ts), + NextBillingTime: db.NewVarCharTime(ts), } newCC, err := mnr.ResetUsage(context.Background(), oldCC) require.NoError(t, err) diff --git a/components/usage/pkg/db/dbtest/conn.go b/components/common-go/db/dbtest/conn.go similarity index 80% rename from components/usage/pkg/db/dbtest/conn.go rename to components/common-go/db/dbtest/conn.go index 1f14313d4a133d..ba8df25827d8b4 100644 --- a/components/usage/pkg/db/dbtest/conn.go +++ b/components/common-go/db/dbtest/conn.go @@ -8,7 +8,7 @@ import ( "sync" "testing" - common_db "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/stretchr/testify/require" "gorm.io/gorm" ) @@ -31,13 +31,13 @@ func ConnectForTests(t *testing.T) *gorm.DB { // These are static connection details for tests, started by `leeway components/usage:init-testdb`. // We use the same static credentials for CI & local instance of MySQL Server. var err error - conn, err = common_db.Connect(common_db.ConnectionParams{ + conn, err = db.Connect(db.ConnectionParams{ User: "root", Password: "test", Host: "localhost:23306", Database: "gitpod", }) - require.NoError(t, err, "Failed to establish connection to DB. In a workspace, run `leeway build components/usage:init-testdb` once to bootstrap the DB.") + require.NoError(t, err, "Failed to establish connection to DB. In a workspace, run `leeway build components/common-go:init-testdb` once to bootstrap the db.") return conn } diff --git a/components/usage/pkg/db/dbtest/cost_center.go b/components/common-go/db/dbtest/cost_center.go similarity index 83% rename from components/usage/pkg/db/dbtest/cost_center.go rename to components/common-go/db/dbtest/cost_center.go index 619e1b2d3f751c..98398b7e3173bd 100644 --- a/components/usage/pkg/db/dbtest/cost_center.go +++ b/components/common-go/db/dbtest/cost_center.go @@ -8,8 +8,7 @@ import ( "testing" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "github.com/stretchr/testify/require" "gorm.io/gorm" @@ -20,11 +19,11 @@ func NewCostCenter(t *testing.T, record db.CostCenter) db.CostCenter { result := db.CostCenter{ ID: db.NewUserAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(time.Now()), + CreationTime: db.NewVarCharTime(time.Now()), SpendingLimit: 100, BillingStrategy: db.CostCenter_Stripe, - BillingCycleStart: common_db.NewVarCharTime(time.Now()), - NextBillingTime: common_db.NewVarCharTime(time.Now().Add(10 * time.Hour)), + BillingCycleStart: db.NewVarCharTime(time.Now()), + NextBillingTime: db.NewVarCharTime(time.Now().Add(10 * time.Hour)), } if record.ID != "" { diff --git a/components/usage/pkg/db/dbtest/stripe_customer.go b/components/common-go/db/dbtest/stripe_customer.go similarity index 89% rename from components/usage/pkg/db/dbtest/stripe_customer.go rename to components/common-go/db/dbtest/stripe_customer.go index 389422ee93301d..79dcd969383ce4 100644 --- a/components/usage/pkg/db/dbtest/stripe_customer.go +++ b/components/common-go/db/dbtest/stripe_customer.go @@ -9,8 +9,7 @@ import ( "testing" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "github.com/stretchr/testify/require" "gorm.io/gorm" @@ -22,7 +21,7 @@ func NewStripeCustomer(t *testing.T, customer db.StripeCustomer) db.StripeCustom result := db.StripeCustomer{ StripeCustomerID: fmt.Sprintf("cus_%s", uuid.New().String()), AttributionID: db.NewUserAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(time.Now()), + CreationTime: db.NewVarCharTime(time.Now()), } if customer.StripeCustomerID != "" { diff --git a/components/usage/pkg/db/dbtest/usage.go b/components/common-go/db/dbtest/usage.go similarity index 92% rename from components/usage/pkg/db/dbtest/usage.go rename to components/common-go/db/dbtest/usage.go index 2b84e84aa55bee..58b67a4384a476 100644 --- a/components/usage/pkg/db/dbtest/usage.go +++ b/components/common-go/db/dbtest/usage.go @@ -8,8 +8,7 @@ import ( "context" "testing" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "github.com/stretchr/testify/require" "gorm.io/gorm" @@ -25,7 +24,7 @@ func NewUsage(t *testing.T, record db.Usage) db.Usage { AttributionID: db.NewUserAttributionID(uuid.New().String()), Description: "some description", CreditCents: 42, - EffectiveTime: common_db.VarcharTime{}, + EffectiveTime: db.VarcharTime{}, Kind: db.WorkspaceInstanceUsageKind, WorkspaceInstanceID: &workspaceInstanceId, } diff --git a/components/usage/pkg/db/dbtest/user.go b/components/common-go/db/dbtest/user.go similarity index 73% rename from components/usage/pkg/db/dbtest/user.go rename to components/common-go/db/dbtest/user.go index 82b7551b67468f..51daa95dec40c3 100644 --- a/components/usage/pkg/db/dbtest/user.go +++ b/components/common-go/db/dbtest/user.go @@ -8,18 +8,18 @@ import ( "testing" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "github.com/stretchr/testify/require" "gorm.io/gorm" ) type User struct { - ID uuid.UUID `gorm:"primary_key;column:id;type:char;size:36;"` - AvatarURL string `gorm:"column:avatarUrl;type:char;size:255;"` - Name string `gorm:"column:name;type:char;size:255;"` - FullName string `gorm:"column:fullName;type:char;size:255;"` - CreationDate common_db.VarcharTime `gorm:"column:creationDate;type:varchar;size:255;"` + ID uuid.UUID `gorm:"primary_key;column:id;type:char;size:36;"` + AvatarURL string `gorm:"column:avatarUrl;type:char;size:255;"` + Name string `gorm:"column:name;type:char;size:255;"` + FullName string `gorm:"column:fullName;type:char;size:255;"` + CreationDate db.VarcharTime `gorm:"column:creationDate;type:varchar;size:255;"` // user has more field but we don't care here as they are just used in tests. } @@ -36,7 +36,7 @@ func NewUser(t *testing.T, user User) User { AvatarURL: "https://avatars.githubusercontent.com/u/9071", Name: "HomerJSimpson", FullName: "Homer Simpson", - CreationDate: common_db.NewVarCharTime(time.Now()), + CreationDate: db.NewVarCharTime(time.Now()), } if user.ID != uuid.Nil { diff --git a/components/usage/pkg/db/dbtest/workspace.go b/components/common-go/db/dbtest/workspace.go similarity index 99% rename from components/usage/pkg/db/dbtest/workspace.go rename to components/common-go/db/dbtest/workspace.go index 1fc1c0c04ab141..c1c84846b61443 100644 --- a/components/usage/pkg/db/dbtest/workspace.go +++ b/components/common-go/db/dbtest/workspace.go @@ -6,12 +6,13 @@ package dbtest import ( "database/sql" + "testing" + + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/namegen" - "github.com/gitpod-io/gitpod/usage/pkg/db" "github.com/google/uuid" "github.com/stretchr/testify/require" "gorm.io/gorm" - "testing" ) const ( diff --git a/components/usage/pkg/db/dbtest/workspace_instance.go b/components/common-go/db/dbtest/workspace_instance.go similarity index 92% rename from components/usage/pkg/db/dbtest/workspace_instance.go rename to components/common-go/db/dbtest/workspace_instance.go index 30e40d89970efa..034324eb3664f8 100644 --- a/components/usage/pkg/db/dbtest/workspace_instance.go +++ b/components/common-go/db/dbtest/workspace_instance.go @@ -10,8 +10,7 @@ import ( "testing" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "github.com/stretchr/testify/require" "gorm.io/gorm" @@ -34,31 +33,31 @@ func NewWorkspaceInstance(t *testing.T, instance db.WorkspaceInstance) db.Worksp workspaceID = instance.WorkspaceID } - creationTime := common_db.VarcharTime{} + creationTime := db.VarcharTime{} if instance.CreationTime.IsSet() { creationTime = instance.CreationTime } else if instance.StartedTime.IsSet() { creationTime = instance.StartedTime } - startedTime := common_db.VarcharTime{} + startedTime := db.VarcharTime{} if instance.StartedTime.IsSet() { startedTime = instance.StartedTime } - deployedTime := common_db.VarcharTime{} + deployedTime := db.VarcharTime{} if instance.DeployedTime.IsSet() { deployedTime = instance.DeployedTime } - stoppedTime := common_db.VarcharTime{} + stoppedTime := db.VarcharTime{} if instance.StoppedTime.IsSet() { stoppedTime = instance.StoppedTime } else if instance.StoppingTime.IsSet() { creationTime = instance.StoppingTime } - stoppingTime := common_db.VarcharTime{} + stoppingTime := db.VarcharTime{} if instance.StoppingTime.IsSet() { stoppingTime = instance.StoppingTime } diff --git a/components/usage/pkg/db/errors.go b/components/common-go/db/errors.go similarity index 100% rename from components/usage/pkg/db/errors.go rename to components/common-go/db/errors.go diff --git a/components/usage/pkg/db/order.go b/components/common-go/db/order.go similarity index 100% rename from components/usage/pkg/db/order.go rename to components/common-go/db/order.go diff --git a/components/usage/pkg/db/project.go b/components/common-go/db/project.go similarity index 81% rename from components/usage/pkg/db/project.go rename to components/common-go/db/project.go index c12ed2b6b50cc8..f05e545fbe2126 100644 --- a/components/usage/pkg/db/project.go +++ b/components/common-go/db/project.go @@ -8,7 +8,6 @@ import ( "database/sql" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "gorm.io/datatypes" ) @@ -22,8 +21,8 @@ type Project struct { AppInstallationID string `gorm:"column:appInstallationId;type:varchar;size:255;" json:"appInstallationId"` - CreationTime common_db.VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` - LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` + CreationTime VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` + LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` TeamID sql.NullString `gorm:"column:teamId;type:char;size:36;" json:"teamId"` UserID sql.NullString `gorm:"column:userId;type:char;size:36;" json:"userId"` diff --git a/components/usage/pkg/db/project_test.go b/components/common-go/db/project_test.go similarity index 95% rename from components/usage/pkg/db/project_test.go rename to components/common-go/db/project_test.go index 18d46151087b38..1424c0907efc4c 100644 --- a/components/usage/pkg/db/project_test.go +++ b/components/common-go/db/project_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" "gorm.io/gorm" diff --git a/components/usage/pkg/db/stripe_customer.go b/components/common-go/db/stripe_customer.go similarity index 82% rename from components/usage/pkg/db/stripe_customer.go rename to components/common-go/db/stripe_customer.go index 3e101f4d370721..a0c02baa8da476 100644 --- a/components/usage/pkg/db/stripe_customer.go +++ b/components/common-go/db/stripe_customer.go @@ -10,14 +10,13 @@ import ( "fmt" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "gorm.io/gorm" ) type StripeCustomer struct { - StripeCustomerID string `gorm:"primary_key;column:stripeCustomerId;type:char;size:255;" json:"stripeCustomerId"` - AttributionID AttributionID `gorm:"column:attributionId;type:varchar;size:255;" json:"attributionId"` - CreationTime common_db.VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` + StripeCustomerID string `gorm:"primary_key;column:stripeCustomerId;type:char;size:255;" json:"stripeCustomerId"` + AttributionID AttributionID `gorm:"column:attributionId;type:varchar;size:255;" json:"attributionId"` + CreationTime VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` LastModified time.Time `gorm:"->;column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` // deleted is reserved for use by db-sync. @@ -31,7 +30,7 @@ func (d *StripeCustomer) TableName() string { func CreateStripeCustomer(ctx context.Context, conn *gorm.DB, customer StripeCustomer) error { if !customer.CreationTime.IsSet() { - customer.CreationTime = common_db.NewVarCharTime(time.Now()) + customer.CreationTime = NewVarCharTime(time.Now()) } tx := conn.WithContext(ctx).Create(customer) diff --git a/components/usage/pkg/db/stripe_customer_test.go b/components/common-go/db/stripe_customer_test.go similarity index 88% rename from components/usage/pkg/db/stripe_customer_test.go rename to components/common-go/db/stripe_customer_test.go index ad06351fe6c814..1901fbd99797c9 100644 --- a/components/usage/pkg/db/stripe_customer_test.go +++ b/components/common-go/db/stripe_customer_test.go @@ -9,9 +9,8 @@ import ( "testing" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" ) @@ -22,7 +21,7 @@ func TestCreateStripeCustomer(t *testing.T) { customer := db.StripeCustomer{ StripeCustomerID: "cus_1234", AttributionID: db.NewUserAttributionID(uuid.New().String()), - CreationTime: common_db.NewVarCharTime(time.Now()), + CreationTime: db.NewVarCharTime(time.Now()), } t.Cleanup(func() { require.NoError(t, conn.Delete(&customer).Error) @@ -61,11 +60,11 @@ func TestGetStripeCustomerByAttributionID_ReturnsLatestRecord(t *testing.T) { attributionID := db.NewTeamAttributionID(uuid.New().String()) first := dbtest.NewStripeCustomer(t, db.StripeCustomer{ AttributionID: attributionID, - CreationTime: common_db.NewVarCharTime(now.Add(-1 * time.Hour)), + CreationTime: db.NewVarCharTime(now.Add(-1 * time.Hour)), }) second := dbtest.NewStripeCustomer(t, db.StripeCustomer{ AttributionID: attributionID, - CreationTime: common_db.NewVarCharTime(now), + CreationTime: db.NewVarCharTime(now), }) dbtest.CreateStripeCustomers(t, conn, first, second) diff --git a/components/usage/pkg/db/team.go b/components/common-go/db/team.go similarity index 73% rename from components/usage/pkg/db/team.go rename to components/common-go/db/team.go index 15754aa964b155..d308755aa63eca 100644 --- a/components/usage/pkg/db/team.go +++ b/components/common-go/db/team.go @@ -7,7 +7,6 @@ package db import ( "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" ) @@ -16,8 +15,8 @@ type Team struct { Name string `gorm:"column:name;type:varchar;size:255;" json:"name"` Slug string `gorm:"column:slug;type:varchar;size:255;" json:"slug"` - CreationTime common_db.VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` - LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` + CreationTime VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` + LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` MarkedDeleted bool `gorm:"column:markedDeleted;type:tinyint;default:0;" json:"marked_deleted"` diff --git a/components/usage/pkg/db/team_membership.go b/components/common-go/db/team_membership.go similarity index 91% rename from components/usage/pkg/db/team_membership.go rename to components/common-go/db/team_membership.go index 3d2c96464c3581..0d1ff092aae8ee 100644 --- a/components/usage/pkg/db/team_membership.go +++ b/components/common-go/db/team_membership.go @@ -9,7 +9,6 @@ import ( "fmt" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "gorm.io/gorm" ) @@ -22,7 +21,7 @@ type TeamMembership struct { Role TeamMembershipRole `gorm:"column:role;type:varchar;size:255;" json:"role"` SubscriptionID uuid.UUID `gorm:"column:subscriptionId;type:char;size:36;" json:"subscriptionId"` - CreationTime common_db.VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` + CreationTime VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` // Read-only (-> property). LastModified time.Time `gorm:"->:column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` diff --git a/components/usage/pkg/db/team_membership_test.go b/components/common-go/db/team_membership_test.go similarity index 96% rename from components/usage/pkg/db/team_membership_test.go rename to components/common-go/db/team_membership_test.go index 16782374acc84a..12f5ca3b5c6fb4 100644 --- a/components/usage/pkg/db/team_membership_test.go +++ b/components/common-go/db/team_membership_test.go @@ -6,8 +6,8 @@ package db_test import ( "context" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" "testing" diff --git a/components/common-go/db/types.go b/components/common-go/db/types.go index e48339511aaae8..61c4a6cf168a91 100644 --- a/components/common-go/db/types.go +++ b/components/common-go/db/types.go @@ -2,7 +2,7 @@ // Licensed under the GNU Affero General Public License (AGPL). // See License-AGPL.txt in the project root for license information. -package common_db +package db import ( "database/sql/driver" diff --git a/components/common-go/db/types_test.go b/components/common-go/db/types_test.go index 87b5612d52a61f..b8bffbae20c6f3 100644 --- a/components/common-go/db/types_test.go +++ b/components/common-go/db/types_test.go @@ -2,7 +2,7 @@ // Licensed under the GNU Affero General Public License (AGPL). // See License-AGPL.txt in the project root for license information. -package common_db +package db import ( "encoding/json" diff --git a/components/usage/pkg/db/usage.go b/components/common-go/db/usage.go similarity index 83% rename from components/usage/pkg/db/usage.go rename to components/common-go/db/usage.go index d7fecece85801b..5f6af872993ec2 100644 --- a/components/usage/pkg/db/usage.go +++ b/components/common-go/db/usage.go @@ -11,7 +11,6 @@ import ( "math" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "gorm.io/datatypes" "gorm.io/gorm" @@ -37,15 +36,15 @@ func (cc CreditCents) ToCredits() float64 { } type Usage struct { - ID uuid.UUID `gorm:"primary_key;column:id;type:char;size:36;" json:"id"` - AttributionID AttributionID `gorm:"column:attributionId;type:varchar;size:255;" json:"attributionId"` - Description string `gorm:"column:description;type:varchar;size:255;" json:"description"` - CreditCents CreditCents `gorm:"column:creditCents;type:bigint;" json:"creditCents"` - EffectiveTime common_db.VarcharTime `gorm:"column:effectiveTime;type:varchar;size:255;" json:"effectiveTime"` - Kind UsageKind `gorm:"column:kind;type:char;size:10;" json:"kind"` - WorkspaceInstanceID *uuid.UUID `gorm:"column:workspaceInstanceId;type:char;size:36;" json:"workspaceInstanceId"` - Draft bool `gorm:"column:draft;type:boolean;" json:"draft"` - Metadata datatypes.JSON `gorm:"column:metadata;type:text;size:65535" json:"metadata"` + ID uuid.UUID `gorm:"primary_key;column:id;type:char;size:36;" json:"id"` + AttributionID AttributionID `gorm:"column:attributionId;type:varchar;size:255;" json:"attributionId"` + Description string `gorm:"column:description;type:varchar;size:255;" json:"description"` + CreditCents CreditCents `gorm:"column:creditCents;type:bigint;" json:"creditCents"` + EffectiveTime VarcharTime `gorm:"column:effectiveTime;type:varchar;size:255;" json:"effectiveTime"` + Kind UsageKind `gorm:"column:kind;type:char;size:10;" json:"kind"` + WorkspaceInstanceID *uuid.UUID `gorm:"column:workspaceInstanceId;type:char;size:36;" json:"workspaceInstanceId"` + Draft bool `gorm:"column:draft;type:boolean;" json:"draft"` + Metadata datatypes.JSON `gorm:"column:metadata;type:text;size:65535" json:"metadata"` } func (u *Usage) SetMetadataWithWorkspaceInstance(data WorkspaceInstanceUsageData) error { @@ -139,7 +138,7 @@ func FindUsage(ctx context.Context, conn *gorm.DB, params *FindUsageParams) ([]U db := conn.WithContext(ctx). Where("attributionId = ?", params.AttributionId). - Where("effectiveTime >= ? AND effectiveTime < ?", common_db.TimeToISO8601(params.From), common_db.TimeToISO8601(params.To)). + Where("effectiveTime >= ? AND effectiveTime < ?", TimeToISO8601(params.From), TimeToISO8601(params.To)). Where("kind = ?", WorkspaceInstanceUsageKind) if params.ExcludeDrafts { db = db.Where("draft = ?", false) @@ -179,7 +178,7 @@ func GetUsageSummary(ctx context.Context, conn *gorm.DB, params GetUsageSummaryP query1 := db.Table((&Usage{}).TableName()). Select("sum(creditCents) as CreditCentsUsed, count(*) as NumberOfRecords"). Where("attributionId = ?", params.AttributionId). - Where("effectiveTime >= ? AND effectiveTime < ?", common_db.TimeToISO8601(params.From), common_db.TimeToISO8601(params.To)). + Where("effectiveTime >= ? AND effectiveTime < ?", TimeToISO8601(params.From), TimeToISO8601(params.To)). Where("kind = ?", WorkspaceInstanceUsageKind) if params.ExcludeDrafts { query1 = query1.Where("draft = ?", false) diff --git a/components/usage/pkg/db/usage_test.go b/components/common-go/db/usage_test.go similarity index 89% rename from components/usage/pkg/db/usage_test.go rename to components/common-go/db/usage_test.go index be2fc19a5f3e4e..f10b446744c9ac 100644 --- a/components/usage/pkg/db/usage_test.go +++ b/components/common-go/db/usage_test.go @@ -10,9 +10,8 @@ import ( "testing" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" ) @@ -27,18 +26,18 @@ func TestFindUsageInRange(t *testing.T) { entryBefore := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), Draft: true, }) entryInside := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Minute)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Minute)), }) entryAfter := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(end.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(end.Add(2 * time.Hour)), }) usageEntries := []db.Usage{entryBefore, entryInside, entryAfter} @@ -64,40 +63,40 @@ func TestGetUsageSummary(t *testing.T) { draftBefore := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), CreditCents: 100, Draft: true, }) nondraftBefore := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), CreditCents: 200, Draft: false, }) draftInside := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), CreditCents: 300, Draft: true, }) nonDraftInside := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), CreditCents: 400, Draft: false, }) nonDraftAfter := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(end.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(end.Add(2 * time.Hour)), CreditCents: 1000, }) invoice := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, Kind: db.InvoiceUsageKind, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), CreditCents: -400, Draft: false, }) @@ -144,7 +143,7 @@ func TestInsertUsageRecords(t *testing.T) { usage := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), Draft: true, }) @@ -179,7 +178,7 @@ func TestUpdateUsageRecords(t *testing.T) { usage := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), Draft: true, }) @@ -204,17 +203,17 @@ func TestFindAllDraftUsage(t *testing.T) { usage1 := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), Draft: true, }) usage2 := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), Draft: true, }) usage3 := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), Draft: false, }) diff --git a/components/usage/pkg/db/varchar_test.go b/components/common-go/db/varchar_test.go similarity index 79% rename from components/usage/pkg/db/varchar_test.go rename to components/common-go/db/varchar_test.go index 063ab321564345..eea8d2283992fe 100644 --- a/components/usage/pkg/db/varchar_test.go +++ b/components/common-go/db/varchar_test.go @@ -7,8 +7,8 @@ package db_test import ( "testing" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/stretchr/testify/require" "gorm.io/gorm" ) @@ -16,8 +16,8 @@ import ( func TestVarcharTime_SerializeAndDeserialize(t *testing.T) { // Custom table to be able to exercise serialization easily, independent of other models type VarcharModel struct { - ID int `gorm:"primaryKey"` - Time common_db.VarcharTime `gorm:"column:time;type:varchar(255);"` + ID int `gorm:"primaryKey"` + Time db.VarcharTime `gorm:"column:time;type:varchar(255);"` } conn := dbtest.ConnectForTests(t) @@ -34,11 +34,11 @@ func TestVarcharTime_SerializeAndDeserialize(t *testing.T) { Description: "empty value for VarcharTime", Input: VarcharModel{ ID: 1, - Time: common_db.VarcharTime{}, + Time: db.VarcharTime{}, }, Expected: VarcharModel{ ID: 1, - Time: common_db.VarcharTime{}, + Time: db.VarcharTime{}, }, }, } { diff --git a/components/usage/pkg/db/workspace.go b/components/common-go/db/workspace.go similarity index 85% rename from components/usage/pkg/db/workspace.go rename to components/common-go/db/workspace.go index 829822aeb493a2..36aba293aaf07f 100644 --- a/components/usage/pkg/db/workspace.go +++ b/components/common-go/db/workspace.go @@ -11,7 +11,6 @@ import ( "math" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/uuid" "gorm.io/datatypes" "gorm.io/gorm" @@ -35,10 +34,10 @@ type Workspace struct { ImageNameResolved string `gorm:"column:imageNameResolved;type:varchar;size:255;" json:"imageNameResolved"` BaseImageNameResolved string `gorm:"column:baseImageNameResolved;type:varchar;size:255;" json:"baseImageNameResolved"` - CreationTime common_db.VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` - LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` - SoftDeletedTime common_db.VarcharTime `gorm:"column:softDeletedTime;type:varchar;size:255;" json:"softDeletedTime"` - ContentDeletedTime common_db.VarcharTime `gorm:"column:contentDeletedTime;type:varchar;size:255;" json:"contentDeletedTime"` + CreationTime VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` + LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` + SoftDeletedTime VarcharTime `gorm:"column:softDeletedTime;type:varchar;size:255;" json:"softDeletedTime"` + ContentDeletedTime VarcharTime `gorm:"column:contentDeletedTime;type:varchar;size:255;" json:"contentDeletedTime"` Archived bool `gorm:"column:archived;type:tinyint;default:0;" json:"archived"` Shareable bool `gorm:"column:shareable;type:tinyint;default:0;" json:"shareable"` diff --git a/components/usage/pkg/db/workspace_instance.go b/components/common-go/db/workspace_instance.go similarity index 88% rename from components/usage/pkg/db/workspace_instance.go rename to components/common-go/db/workspace_instance.go index 4bf111b2023187..f622057581aa35 100644 --- a/components/usage/pkg/db/workspace_instance.go +++ b/components/common-go/db/workspace_instance.go @@ -11,7 +11,6 @@ import ( "strings" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/log" "github.com/google/uuid" @@ -31,12 +30,12 @@ type WorkspaceInstance struct { UsageAttributionID AttributionID `gorm:"column:usageAttributionId;type:varchar;size:60;" json:"usageAttributionId"` WorkspaceClass string `gorm:"column:workspaceClass;type:varchar;size:255;" json:"workspaceClass"` - CreationTime common_db.VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` - StartedTime common_db.VarcharTime `gorm:"column:startedTime;type:varchar;size:255;" json:"startedTime"` - DeployedTime common_db.VarcharTime `gorm:"column:deployedTime;type:varchar;size:255;" json:"deployedTime"` - StoppedTime common_db.VarcharTime `gorm:"column:stoppedTime;type:varchar;size:255;" json:"stoppedTime"` - LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` - StoppingTime common_db.VarcharTime `gorm:"column:stoppingTime;type:varchar;size:255;" json:"stoppingTime"` + CreationTime VarcharTime `gorm:"column:creationTime;type:varchar;size:255;" json:"creationTime"` + StartedTime VarcharTime `gorm:"column:startedTime;type:varchar;size:255;" json:"startedTime"` + DeployedTime VarcharTime `gorm:"column:deployedTime;type:varchar;size:255;" json:"deployedTime"` + StoppedTime VarcharTime `gorm:"column:stoppedTime;type:varchar;size:255;" json:"stoppedTime"` + LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"` + StoppingTime VarcharTime `gorm:"column:stoppingTime;type:varchar;size:255;" json:"stoppingTime"` LastHeartbeat string `gorm:"column:lastHeartbeat;type:varchar;size:255;" json:"lastHeartbeat"` StatusOld sql.NullString `gorm:"column:status_old;type:varchar;size:255;" json:"status_old"` @@ -60,8 +59,8 @@ func FindStoppedWorkspaceInstancesInRange(ctx context.Context, conn *gorm.DB, fr var instancesInBatch []WorkspaceInstanceForUsage tx := queryWorkspaceInstanceForUsage(ctx, conn). - Where("wsi.stoppingTime >= ?", common_db.TimeToISO8601(from)). - Where("wsi.stoppingTime < ?", common_db.TimeToISO8601(to)). + Where("wsi.stoppingTime >= ?", TimeToISO8601(from)). + Where("wsi.stoppingTime < ?", TimeToISO8601(to)). Where("wsi.stoppingTime != ?", ""). Where("wsi.usageAttributionId != ?", ""). FindInBatches(&instancesInBatch, 1000, func(_ *gorm.DB, _ int) error { @@ -84,7 +83,7 @@ func FindRunningWorkspaceInstances(ctx context.Context, conn *gorm.DB) ([]Worksp Where("wsi.stoppingTime = ?", ""). Where("wsi.usageAttributionId != ?", ""). // We cannot guarantee data quality before this date - Where("wsi.startedTime > ?", common_db.TimeToISO8601(time.Date(2022, 8, 1, 0, 0, 0, 0, time.UTC))). + Where("wsi.startedTime > ?", TimeToISO8601(time.Date(2022, 8, 1, 0, 0, 0, 0, time.UTC))). FindInBatches(&instancesInBatch, 1000, func(_ *gorm.DB, _ int) error { instances = append(instances, instancesInBatch...) return nil @@ -220,8 +219,8 @@ type WorkspaceInstanceForUsage struct { UserName string `gorm:"column:userName;type:varchar;size:255;" json:"userName"` UserAvatarURL string `gorm:"column:userAvatarURL;type:varchar;size:255;" json:"userAvatarURL"` - StartedTime common_db.VarcharTime `gorm:"column:startedTime;type:varchar;size:255;" json:"startedTime"` - StoppingTime common_db.VarcharTime `gorm:"column:stoppingTime;type:varchar;size:255;" json:"stoppingTime"` + StartedTime VarcharTime `gorm:"column:startedTime;type:varchar;size:255;" json:"startedTime"` + StoppingTime VarcharTime `gorm:"column:stoppingTime;type:varchar;size:255;" json:"stoppingTime"` } // WorkspaceRuntimeSeconds computes how long this WorkspaceInstance has been running. @@ -238,10 +237,10 @@ func (i *WorkspaceInstanceForUsage) WorkspaceRuntimeSeconds(stopTimeIfInstanceIs log. WithField("instance_id", i.ID). WithField("workspace_id", i.WorkspaceID). - WithField("started_time", common_db.TimeToISO8601(i.StartedTime.Time())). + WithField("started_time", TimeToISO8601(i.StartedTime.Time())). WithField("started_time_set", i.StartedTime.IsSet()). WithField("stopping_time_set", i.StartedTime.IsSet()). - WithField("stopping_time", common_db.TimeToISO8601(i.StartedTime.Time())). + WithField("stopping_time", TimeToISO8601(i.StartedTime.Time())). WithField("stop_time_if_instance_still_running", stopTimeIfInstanceIsStillRunning). Errorf("Instance %s had stop time before start time. Using startedTime as stop time.", i.ID) diff --git a/components/usage/pkg/db/workspace_instance_test.go b/components/common-go/db/workspace_instance_test.go similarity index 57% rename from components/usage/pkg/db/workspace_instance_test.go rename to components/common-go/db/workspace_instance_test.go index ff777a82398006..f9b7f37cac3412 100644 --- a/components/usage/pkg/db/workspace_instance_test.go +++ b/components/common-go/db/workspace_instance_test.go @@ -10,11 +10,8 @@ import ( "testing" "time" - "github.com/gitpod-io/gitpod/usage/pkg/apiv1" - - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" ) @@ -33,29 +30,29 @@ func TestFindStoppedWorkspaceInstancesInRange(t *testing.T) { // In the middle of May dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 05, 15, 13, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 05, 15, 13, 00, 00, 00, time.UTC)), }), // Start of May dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 1, 0, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 05, 1, 1, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 1, 0, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 05, 1, 1, 00, 00, 00, time.UTC)), }), // End of May dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 31, 23, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 05, 31, 23, 59, 59, 999999, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 31, 23, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 05, 31, 23, 59, 59, 999999, time.UTC)), }), // Started in April, but continued into May dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 04, 30, 23, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 05, 1, 0, 0, 0, 0, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 04, 30, 23, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 05, 1, 0, 0, 0, 0, time.UTC)), }), } invalid := []db.WorkspaceInstance{ @@ -63,28 +60,28 @@ func TestFindStoppedWorkspaceInstancesInRange(t *testing.T) { dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 04, 31, 23, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 04, 31, 23, 00, 00, 00, time.UTC)), }), // Started in May, but continued into June dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 31, 23, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 06, 1, 1, 0, 0, 0, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 31, 23, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 06, 1, 1, 0, 0, 0, time.UTC)), }), // Started in April, but continued into June (ran for all of May) dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 04, 31, 23, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 06, 1, 1, 0, 0, 0, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 04, 31, 23, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 06, 1, 1, 0, 0, 0, time.UTC)), }), // Start of June dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 06, 1, 00, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 06, 1, 1, 0, 0, 0, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 06, 1, 00, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 06, 1, 1, 0, 0, 0, time.UTC)), }), } @@ -130,24 +127,24 @@ func TestFindRunningWorkspace(t *testing.T) { // one stopped instance dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 05, 15, 13, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 05, 15, 13, 00, 00, 00, time.UTC)), }), // one before August 2022, excluded dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), }), // Two running instances dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 9, 1, 0, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 9, 1, 0, 00, 00, 00, time.UTC)), }), dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 9, 30, 23, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 9, 30, 23, 00, 00, 00, time.UTC)), }), } @@ -171,19 +168,19 @@ func TestFindWorkspacesByInstanceId(t *testing.T) { // one stopped instance dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 05, 15, 13, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 15, 12, 00, 00, 00, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 05, 15, 13, 00, 00, 00, time.UTC)), }), // Two running instances dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 05, 1, 0, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 05, 1, 0, 00, 00, 00, time.UTC)), }), dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ ID: uuid.New(), WorkspaceID: workspace.ID, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 04, 30, 23, 00, 00, 00, time.UTC)), + StartedTime: db.NewVarCharTime(time.Date(2022, 04, 30, 23, 00, 00, 00, time.UTC)), }), } @@ -201,62 +198,16 @@ func TestFindWorkspacesByInstanceId(t *testing.T) { } -func TestWorkspaceInstanceForUsage_WorkspaceRuntimeSeconds(t *testing.T) { - type Scenario struct { - Name string - Instance *db.WorkspaceInstanceForUsage - StopTimeIfStillRunning time.Time - ExpectedCredits float64 - } - - for _, s := range []Scenario{ - { - Name: "does not use stop time if still running if the instance stopped", - Instance: &db.WorkspaceInstanceForUsage{ - WorkspaceClass: db.WorkspaceClass_Default, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 9, 8, 12, 0, 0, 0, time.UTC)), - StoppingTime: common_db.NewVarCharTime(time.Date(2022, 9, 8, 12, 6, 0, 0, time.UTC)), - }, - // Override is before actual stop time - StopTimeIfStillRunning: time.Date(2022, 9, 8, 11, 21, 29, 00, time.UTC), - ExpectedCredits: 1, - }, - { - Name: "uses stop time when instance is not stopped", - Instance: &db.WorkspaceInstanceForUsage{ - WorkspaceClass: db.WorkspaceClass_Default, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 9, 8, 12, 0, 0, 0, time.UTC)), - }, - StopTimeIfStillRunning: time.Date(2022, 9, 8, 12, 12, 0, 00, time.UTC), - ExpectedCredits: 2, - }, - { - Name: "uses creation time when stop time if still running is less than started time", - Instance: &db.WorkspaceInstanceForUsage{ - WorkspaceClass: db.WorkspaceClass_Default, - StartedTime: common_db.NewVarCharTime(time.Date(2022, 9, 8, 12, 0, 0, 0, time.UTC)), - }, - StopTimeIfStillRunning: time.Date(2022, 9, 8, 11, 0, 0, 00, time.UTC), - ExpectedCredits: 0, - }, - } { - t.Run(s.Name, func(t *testing.T) { - credits := apiv1.DefaultWorkspacePricer.CreditsUsedByInstance(s.Instance, s.StopTimeIfStillRunning) - require.Equal(t, s.ExpectedCredits, credits) - }) - } -} - func TestListWorkspaceInstanceIDsWithPhaseStoppedButNoStoppingTime(t *testing.T) { dbconn := dbtest.ConnectForTests(t) instances := dbtest.CreateWorkspaceInstances(t, dbconn, // started but not stopped, should be ignored dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ - StartedTime: common_db.NewVarCharTime(time.Now()), + StartedTime: db.NewVarCharTime(time.Now()), }), // stopped, but no stopping time, should be detected dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ - StartedTime: common_db.NewVarCharTime(time.Now()), + StartedTime: db.NewVarCharTime(time.Now()), PhasePersisted: "stopped", }), ) diff --git a/components/usage/pkg/db/workspace_test.go b/components/common-go/db/workspace_test.go similarity index 85% rename from components/usage/pkg/db/workspace_test.go rename to components/common-go/db/workspace_test.go index 6207bce00a8d8c..161a1e27e94583 100644 --- a/components/usage/pkg/db/workspace_test.go +++ b/components/common-go/db/workspace_test.go @@ -8,16 +8,15 @@ import ( "context" "testing" - common_db "github.com/gitpod-io/gitpod/common-go/db" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/stretchr/testify/require" ) -func stringToVarchar(t *testing.T, s string) common_db.VarcharTime { +func stringToVarchar(t *testing.T, s string) db.VarcharTime { t.Helper() - converted, err := common_db.NewVarCharTimeFromStr(s) + converted, err := db.NewVarCharTimeFromStr(s) require.NoError(t, err) return converted } diff --git a/components/common-go/go.mod b/components/common-go/go.mod index 83a306f2850c41..19e1bbb0779e7e 100644 --- a/components/common-go/go.mod +++ b/components/common-go/go.mod @@ -36,7 +36,9 @@ require ( require ( github.com/go-sql-driver/mysql v1.6.0 + github.com/google/uuid v1.1.2 github.com/relvacode/iso8601 v1.1.0 + gorm.io/datatypes v1.0.7 gorm.io/driver/mysql v1.4.4 gorm.io/gorm v1.24.1 ) @@ -66,7 +68,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.uber.org/atomic v1.4.0 // indirect + go.uber.org/atomic v1.6.0 // indirect golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 // indirect diff --git a/components/common-go/go.sum b/components/common-go/go.sum index 9b991c2cb3d914..073110f34d78f6 100644 --- a/components/common-go/go.sum +++ b/components/common-go/go.sum @@ -31,10 +31,14 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/HdrHistogram/hdrhistogram-go v1.1.0 h1:6dpdDPTRoo78HxAJ6T1HfMiKSnqhgRRqzCuPshRkQ7I= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= @@ -65,16 +69,23 @@ github.com/cilium/ebpf v0.4.0 h1:QlHdikaxALkqWasW8hAC1mfR0jdmvbfaBdBPFmRSglA= github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/configcat/go-sdk/v7 v7.6.0 h1:CthQJ7DMz4bvUrpc8aek6VouJjisCvZCfuTG2gyNzL4= github.com/configcat/go-sdk/v7 v7.6.0/go.mod h1:2245V6Igy1Xz6GXvcYuK5z996Ct0VyzyuI470XS6aTw= github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denisenkom/go-mssqldb v0.12.0 h1:VtrkII767ttSPNRfFekePK3sctr+joXgO58stqQbtUA= +github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= @@ -120,9 +131,15 @@ github.com/go-test/deep v1.0.5 h1:AKODKU3pDH1RzZzm6YZu77YWtEAq6uh1rLIAQlay2qc= github.com/go-test/deep v1.0.5/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188 h1:+eHOFJl1BaXrQxKX+T06f78590z4qA2ZzBTqahsKSE4= +github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -180,6 +197,7 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= @@ -196,6 +214,54 @@ github.com/heptiolabs/healthcheck v0.0.0-20211123025425-613501dd5deb h1:tsEKRC3P github.com/heptiolabs/healthcheck v0.0.0-20211123025425-613501dd5deb/go.mod h1:NtmN9h8vrTveVQRLHcX2HQ5wIPBDCsZ351TGbZWgg38= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.11.0 h1:HiHArx4yFbwl91X3qqIHtUFoiIfLNJXCQRsnzkiwwaQ= +github.com/jackc/pgconn v1.11.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.2.0 h1:r7JypeP2D3onoQTCxWdTpCtJ4D+qpKr0TxvoyMhZ5ns= +github.com/jackc/pgproto3/v2 v2.2.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= +github.com/jackc/pgtype v1.10.0 h1:ILnBWrRMSXGczYvmkYD6PsYyVFUNLTnIUJHHDLmqk38= +github.com/jackc/pgtype v1.10.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= +github.com/jackc/pgx/v4 v4.15.0 h1:B7dTkXsdILD3MF987WGGCcg+tvLW6bZJdEcqVFeU//w= +github.com/jackc/pgx/v4 v4.15.0/go.mod h1:D/zyOyXiaM1TmVWnOM18p0xdDtdakRBa0RsVGI3U3bw= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= @@ -215,6 +281,7 @@ github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -222,11 +289,24 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0= +github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -238,6 +318,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -257,6 +338,7 @@ github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -291,9 +373,16 @@ github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0ua github.com/relvacode/iso8601 v1.1.0 h1:2nV8sp0eOjpoKQ2vD3xSDygsjAx37NHG2UlZiCkDH4I= github.com/relvacode/iso8601 v1.1.0/go.mod h1:FlNp+jz+TXpyRqgmM7tnzHHzBnz776kmAH2h3sZCn0I= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 h1:ZuhckGJ10ulaKkdvJtiAqsLTiPrLaXSdnVgXJKJkTxE= github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3/go.mod h1:9/Rh6yILuLysoQnZ2oNooD2g7aBnvM7r/fNVxRNWfBc= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= @@ -305,8 +394,9 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -324,22 +414,40 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -365,6 +473,7 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -390,6 +499,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -407,8 +517,11 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -437,7 +550,9 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -445,6 +560,7 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -454,6 +570,7 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -482,6 +599,7 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -489,6 +607,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -506,14 +625,18 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -521,6 +644,7 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -542,7 +666,10 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -645,6 +772,7 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8X gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/segmentio/analytics-go.v3 v3.1.0 h1:UzxH1uaGZRpMKDhJyBz0pexz6yUoBU3x8bJsRk/HV6U= @@ -662,8 +790,19 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/datatypes v1.0.7 h1:8NhJN4+annFjwV1WufDhFiPjdUvV1lSGUdg1UCjQIWY= +gorm.io/datatypes v1.0.7/go.mod h1:l9qkCuy0CdzDEop9HKUdcnC9gHC2sRlaFtHkTzsZRqg= +gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/driver/mysql v1.4.4 h1:MX0K9Qvy0Na4o7qSC/YI7XxqUw5KDw01umqgID+svdQ= gorm.io/driver/mysql v1.4.4/go.mod h1:BCg8cKI+R0j/rZRQxeKis/forqRwRSYOR8OM3Wo6hOM= +gorm.io/driver/postgres v1.3.4 h1:evZ7plF+Bp+Lr1mO5NdPvd6M/N98XtwHixGB+y7fdEQ= +gorm.io/driver/postgres v1.3.4/go.mod h1:y0vEuInFKJtijuSGu9e5bs5hzzSzPK+LancpKpvbRBw= +gorm.io/driver/sqlite v1.3.1 h1:bwfE+zTEWklBYoEodIOIBwuWHpnx52Z9zJFW5F33WLk= +gorm.io/driver/sqlite v1.3.1/go.mod h1:wJx0hJspfycZ6myN38x1O/AqLtNS6c5o9TndewFbELg= +gorm.io/driver/sqlserver v1.3.1 h1:F5t6ScMzOgy1zukRTIZgLZwKahgt3q1woAILVolKpOI= +gorm.io/driver/sqlserver v1.3.1/go.mod h1:w25Vrx2BG+CJNUu/xKbFhaKlGxT/nzRkhWCCoptX8tQ= +gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.24.1 h1:CgvzRniUdG67hBAzsxDGOAuq4Te1osVMYsa1eQbd4fs= gorm.io/gorm v1.24.1/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= diff --git a/components/content-service/go.mod b/components/content-service/go.mod index 0da3a8d767e055..b625e5ddc6675a 100644 --- a/components/content-service/go.mod +++ b/components/content-service/go.mod @@ -75,7 +75,7 @@ require ( github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect go.opencensus.io v0.23.0 // indirect - go.uber.org/atomic v1.4.0 // indirect + go.uber.org/atomic v1.6.0 // indirect golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect golang.org/x/text v0.3.7 // indirect diff --git a/components/content-service/go.sum b/components/content-service/go.sum index fd1dd9fc5f3567..f57983a08b0095 100644 --- a/components/content-service/go.sum +++ b/components/content-service/go.sum @@ -392,8 +392,9 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180807104621-f027049dab0a/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -428,6 +429,7 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -628,6 +630,7 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -665,6 +668,7 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/components/supervisor/go.mod b/components/supervisor/go.mod index 401586e4452f37..b870b34bccf419 100644 --- a/components/supervisor/go.mod +++ b/components/supervisor/go.mod @@ -95,7 +95,7 @@ require ( github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect go.opencensus.io v0.23.0 // indirect - go.uber.org/atomic v1.4.0 // indirect + go.uber.org/atomic v1.6.0 // indirect golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect diff --git a/components/supervisor/go.sum b/components/supervisor/go.sum index f505f0bc63a982..acd2e12ce93f0c 100644 --- a/components/supervisor/go.sum +++ b/components/supervisor/go.sum @@ -448,8 +448,9 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -483,6 +484,7 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -686,6 +688,7 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= diff --git a/components/usage/BUILD.yaml b/components/usage/BUILD.yaml index a1babb1cf09762..598b0f491e2ca9 100644 --- a/components/usage/BUILD.yaml +++ b/components/usage/BUILD.yaml @@ -9,7 +9,7 @@ packages: - components/common-go:lib - components/usage-api/go:lib - components/content-service-api/go:lib - - :init-testdb + - components/common-go:init-testdb env: - CGO_ENABLED=0 - GOOS=linux @@ -31,12 +31,6 @@ packages: packaging: library dontTest: true - - name: init-testdb - type: generic - deps: - - components/gitpod-db:dbtest-init - ephemeral: true - - name: docker type: docker deps: diff --git a/components/usage/go.mod b/components/usage/go.mod index 6ef4c304347b9b..8e54e8dfc58114 100644 --- a/components/usage/go.mod +++ b/components/usage/go.mod @@ -15,7 +15,6 @@ require ( github.com/stripe/stripe-go/v72 v72.114.0 google.golang.org/grpc v1.49.0 google.golang.org/protobuf v1.28.1 - gorm.io/datatypes v1.0.6 gorm.io/gorm v1.24.1 ) @@ -49,6 +48,7 @@ require ( golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gorm.io/datatypes v1.0.7 // indirect gorm.io/driver/mysql v1.4.4 // indirect ) diff --git a/components/usage/go.sum b/components/usage/go.sum index 242e75e9da9ffd..f77f9599ae08c7 100644 --- a/components/usage/go.sum +++ b/components/usage/go.sum @@ -172,7 +172,6 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.10.1/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= github.com/jackc/pgconn v1.11.0 h1:HiHArx4yFbwl91X3qqIHtUFoiIfLNJXCQRsnzkiwwaQ= github.com/jackc/pgconn v1.11.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= @@ -198,20 +197,17 @@ github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01C github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.9.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgtype v1.10.0 h1:ILnBWrRMSXGczYvmkYD6PsYyVFUNLTnIUJHHDLmqk38= github.com/jackc/pgtype v1.10.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.14.1/go.mod h1:RgDuE4Z34o7XE92RpLsvFiOEfrAUT0Xt2KxvX73W06M= github.com/jackc/pgx/v4 v4.15.0 h1:B7dTkXsdILD3MF987WGGCcg+tvLW6bZJdEcqVFeU//w= github.com/jackc/pgx/v4 v4.15.0/go.mod h1:D/zyOyXiaM1TmVWnOM18p0xdDtdakRBa0RsVGI3U3bw= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.2.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= @@ -670,19 +666,19 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/datatypes v1.0.6 h1:3cqbakp1DIgC+P7wyODb5k+lSjW8g3mjkg/BIsmhjlE= -gorm.io/datatypes v1.0.6/go.mod h1:Gh/Xd/iUWWybMEk8CzYCK/swqlni2r+ROeM1HGIM0ck= +gorm.io/datatypes v1.0.7 h1:8NhJN4+annFjwV1WufDhFiPjdUvV1lSGUdg1UCjQIWY= +gorm.io/datatypes v1.0.7/go.mod h1:l9qkCuy0CdzDEop9HKUdcnC9gHC2sRlaFtHkTzsZRqg= gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/driver/mysql v1.4.4 h1:MX0K9Qvy0Na4o7qSC/YI7XxqUw5KDw01umqgID+svdQ= gorm.io/driver/mysql v1.4.4/go.mod h1:BCg8cKI+R0j/rZRQxeKis/forqRwRSYOR8OM3Wo6hOM= -gorm.io/driver/postgres v1.3.1 h1:Pyv+gg1Gq1IgsLYytj/S2k7ebII3CzEdpqQkPOdH24g= -gorm.io/driver/postgres v1.3.1/go.mod h1:WwvWOuR9unCLpGWCL6Y3JOeBWvbKi6JLhayiVclSZZU= +gorm.io/driver/postgres v1.3.4 h1:evZ7plF+Bp+Lr1mO5NdPvd6M/N98XtwHixGB+y7fdEQ= +gorm.io/driver/postgres v1.3.4/go.mod h1:y0vEuInFKJtijuSGu9e5bs5hzzSzPK+LancpKpvbRBw= gorm.io/driver/sqlite v1.3.1 h1:bwfE+zTEWklBYoEodIOIBwuWHpnx52Z9zJFW5F33WLk= gorm.io/driver/sqlite v1.3.1/go.mod h1:wJx0hJspfycZ6myN38x1O/AqLtNS6c5o9TndewFbELg= gorm.io/driver/sqlserver v1.3.1 h1:F5t6ScMzOgy1zukRTIZgLZwKahgt3q1woAILVolKpOI= gorm.io/driver/sqlserver v1.3.1/go.mod h1:w25Vrx2BG+CJNUu/xKbFhaKlGxT/nzRkhWCCoptX8tQ= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.23.2/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.24.1 h1:CgvzRniUdG67hBAzsxDGOAuq4Te1osVMYsa1eQbd4fs= gorm.io/gorm v1.24.1/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= diff --git a/components/usage/pkg/apiv1/billing.go b/components/usage/pkg/apiv1/billing.go index 23058398039347..8a425b23dc3afb 100644 --- a/components/usage/pkg/apiv1/billing.go +++ b/components/usage/pkg/apiv1/billing.go @@ -12,10 +12,9 @@ import ( "math" "time" - common_db "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/log" v1 "github.com/gitpod-io/gitpod/usage-api/v1" - "github.com/gitpod-io/gitpod/usage/pkg/db" "github.com/gitpod-io/gitpod/usage/pkg/stripe" "github.com/google/uuid" stripe_api "github.com/stripe/stripe-go/v72" @@ -155,7 +154,7 @@ func (s *BillingService) CreateStripeCustomer(ctx context.Context, req *v1.Creat err = db.CreateStripeCustomer(ctx, s.conn, db.StripeCustomer{ StripeCustomerID: customer.ID, AttributionID: attributionID, - CreationTime: common_db.NewVarCharTime(time.Unix(customer.Created, 0)), + CreationTime: db.NewVarCharTime(time.Unix(customer.Created, 0)), }) if err != nil { log.WithField("attribution_id", attributionID).WithField("stripe_customer_id", customer.ID).WithError(err).Error("Failed to store Stripe Customer in the database.") @@ -319,7 +318,7 @@ func (s *BillingService) FinalizeInvoice(ctx context.Context, in *v1.FinalizeInv Description: fmt.Sprintf("Invoice %s finalized in Stripe", invoice.ID), // Apply negative value of credits to reduce accrued credit usage CreditCents: db.NewCreditCents(float64(-creditsOnInvoice)), - EffectiveTime: common_db.NewVarCharTime(finalizedAt), + EffectiveTime: db.NewVarCharTime(finalizedAt), Kind: db.InvoiceUsageKind, Draft: false, Metadata: nil, @@ -370,7 +369,7 @@ func (s *BillingService) storeStripeCustomer(ctx context.Context, cus *stripe_ap StripeCustomerID: cus.ID, AttributionID: attributionID, // We use the original Stripe supplied creation timestamp, this ensures that we stay true to our ordering of customer creation records. - CreationTime: common_db.NewVarCharTime(time.Unix(cus.Created, 0)), + CreationTime: db.NewVarCharTime(time.Unix(cus.Created, 0)), }) if err != nil { return nil, err diff --git a/components/usage/pkg/apiv1/billing_test.go b/components/usage/pkg/apiv1/billing_test.go index e778e4ffd05f6b..d46060762de3aa 100644 --- a/components/usage/pkg/apiv1/billing_test.go +++ b/components/usage/pkg/apiv1/billing_test.go @@ -8,8 +8,8 @@ import ( "context" "testing" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" ) diff --git a/components/usage/pkg/apiv1/pricer.go b/components/usage/pkg/apiv1/pricer.go index dbee5a6803e73a..ba4a5a1ef5e7d2 100644 --- a/components/usage/pkg/apiv1/pricer.go +++ b/components/usage/pkg/apiv1/pricer.go @@ -8,7 +8,7 @@ import ( "fmt" "time" - "github.com/gitpod-io/gitpod/usage/pkg/db" + "github.com/gitpod-io/gitpod/common-go/db" ) const ( diff --git a/components/usage/pkg/apiv1/pricer_test.go b/components/usage/pkg/apiv1/pricer_test.go index 1785af30e76e2f..160acc845a446a 100644 --- a/components/usage/pkg/apiv1/pricer_test.go +++ b/components/usage/pkg/apiv1/pricer_test.go @@ -6,7 +6,9 @@ package apiv1 import ( "testing" + "time" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/require" @@ -68,3 +70,49 @@ func TestWorkspacePricer_Default(t *testing.T) { }) } } + +func TestWorkspaceInstanceForUsage_WorkspaceRuntimeSeconds(t *testing.T) { + type Scenario struct { + Name string + Instance *db.WorkspaceInstanceForUsage + StopTimeIfStillRunning time.Time + ExpectedCredits float64 + } + + for _, s := range []Scenario{ + { + Name: "does not use stop time if still running if the instance stopped", + Instance: &db.WorkspaceInstanceForUsage{ + WorkspaceClass: db.WorkspaceClass_Default, + StartedTime: db.NewVarCharTime(time.Date(2022, 9, 8, 12, 0, 0, 0, time.UTC)), + StoppingTime: db.NewVarCharTime(time.Date(2022, 9, 8, 12, 6, 0, 0, time.UTC)), + }, + // Override is before actual stop time + StopTimeIfStillRunning: time.Date(2022, 9, 8, 11, 21, 29, 00, time.UTC), + ExpectedCredits: 1, + }, + { + Name: "uses stop time when instance is not stopped", + Instance: &db.WorkspaceInstanceForUsage{ + WorkspaceClass: db.WorkspaceClass_Default, + StartedTime: db.NewVarCharTime(time.Date(2022, 9, 8, 12, 0, 0, 0, time.UTC)), + }, + StopTimeIfStillRunning: time.Date(2022, 9, 8, 12, 12, 0, 00, time.UTC), + ExpectedCredits: 2, + }, + { + Name: "uses creation time when stop time if still running is less than started time", + Instance: &db.WorkspaceInstanceForUsage{ + WorkspaceClass: db.WorkspaceClass_Default, + StartedTime: db.NewVarCharTime(time.Date(2022, 9, 8, 12, 0, 0, 0, time.UTC)), + }, + StopTimeIfStillRunning: time.Date(2022, 9, 8, 11, 0, 0, 00, time.UTC), + ExpectedCredits: 0, + }, + } { + t.Run(s.Name, func(t *testing.T) { + credits := DefaultWorkspacePricer.CreditsUsedByInstance(s.Instance, s.StopTimeIfStillRunning) + require.Equal(t, s.ExpectedCredits, credits) + }) + } +} diff --git a/components/usage/pkg/apiv1/usage.go b/components/usage/pkg/apiv1/usage.go index 678316690ae676..d6ba00d9a063d4 100644 --- a/components/usage/pkg/apiv1/usage.go +++ b/components/usage/pkg/apiv1/usage.go @@ -12,10 +12,9 @@ import ( "github.com/google/uuid" - common_db "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/log" v1 "github.com/gitpod-io/gitpod/usage-api/v1" - "github.com/gitpod-io/gitpod/usage/pkg/db" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" @@ -195,8 +194,8 @@ func dbCostCenterToAPI(c db.CostCenter) *v1.CostCenter { AttributionId: string(c.ID), SpendingLimit: c.SpendingLimit, BillingStrategy: convertBillingStrategyToAPI(c.BillingStrategy), - NextBillingTime: common_db.VarcharTimeToTimestamppb(c.NextBillingTime), - BillingCycleStart: common_db.VarcharTimeToTimestamppb(c.BillingCycleStart), + NextBillingTime: db.VarcharTimeToTimestamppb(c.NextBillingTime), + BillingCycleStart: db.VarcharTimeToTimestamppb(c.BillingCycleStart), } } @@ -383,7 +382,7 @@ func newUsageFromInstance(instance db.WorkspaceInstanceForUsage, pricer *Workspa AttributionID: instance.UsageAttributionID, Description: usageDescriptionFromController, CreditCents: db.NewCreditCents(pricer.CreditsUsedByInstance(&instance, now)), - EffectiveTime: common_db.NewVarCharTime(effectiveTime), + EffectiveTime: db.NewVarCharTime(effectiveTime), Kind: db.WorkspaceInstanceUsageKind, WorkspaceInstanceID: &instance.ID, Draft: draft, @@ -391,11 +390,11 @@ func newUsageFromInstance(instance db.WorkspaceInstanceForUsage, pricer *Workspa startedTime := "" if instance.StartedTime.IsSet() { - startedTime = common_db.TimeToISO8601(instance.StartedTime.Time()) + startedTime = db.TimeToISO8601(instance.StartedTime.Time()) } endTime := "" if instance.StoppingTime.IsSet() { - endTime = common_db.TimeToISO8601(instance.StoppingTime.Time()) + endTime = db.TimeToISO8601(instance.StoppingTime.Time()) } err := usage.SetMetadataWithWorkspaceInstance(db.WorkspaceInstanceUsageData{ WorkspaceId: instance.WorkspaceID, diff --git a/components/usage/pkg/apiv1/usage_test.go b/components/usage/pkg/apiv1/usage_test.go index 54de0509c15076..82d8c4b56f5e47 100644 --- a/components/usage/pkg/apiv1/usage_test.go +++ b/components/usage/pkg/apiv1/usage_test.go @@ -12,10 +12,9 @@ import ( "time" "github.com/gitpod-io/gitpod/common-go/baseserver" - common_db "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db/dbtest" v1 "github.com/gitpod-io/gitpod/usage-api/v1" - "github.com/gitpod-io/gitpod/usage/pkg/db" - "github.com/gitpod-io/gitpod/usage/pkg/db/dbtest" "github.com/google/uuid" "github.com/stretchr/testify/require" "google.golang.org/grpc" @@ -37,14 +36,14 @@ func TestUsageService_ReconcileUsage(t *testing.T) { // stopped instances instance := dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ UsageAttributionID: attributionID, - StartedTime: common_db.NewVarCharTime(from), - StoppingTime: common_db.NewVarCharTime(to.Add(-1 * time.Minute)), + StartedTime: db.NewVarCharTime(from), + StoppingTime: db.NewVarCharTime(to.Add(-1 * time.Minute)), }) dbtest.CreateWorkspaceInstances(t, dbconn, instance) // running instances dbtest.CreateWorkspaceInstances(t, dbconn, dbtest.NewWorkspaceInstance(t, db.WorkspaceInstance{ - StartedTime: common_db.NewVarCharTime(to.Add(-1 * time.Minute)), + StartedTime: db.NewVarCharTime(to.Add(-1 * time.Minute)), UsageAttributionID: attributionID, })) @@ -135,7 +134,7 @@ func TestReconcile(t *testing.T) { WorkspaceClass: db.WorkspaceClass_Default, Type: db.WorkspaceType_Regular, UsageAttributionID: db.NewTeamAttributionID(uuid.New().String()), - StartedTime: common_db.NewVarCharTime(now.Add(1 * time.Minute)), + StartedTime: db.NewVarCharTime(now.Add(1 * time.Minute)), } inserts, updates, err := reconcileUsage([]db.WorkspaceInstanceForUsage{instance, instance}, nil, pricer, now) @@ -147,7 +146,7 @@ func TestReconcile(t *testing.T) { AttributionID: instance.UsageAttributionID, Description: usageDescriptionFromController, CreditCents: db.NewCreditCents(pricer.CreditsUsedByInstance(&instance, now)), - EffectiveTime: common_db.NewVarCharTime(now), + EffectiveTime: db.NewVarCharTime(now), Kind: db.WorkspaceInstanceUsageKind, WorkspaceInstanceID: &instance.ID, Draft: true, @@ -158,7 +157,7 @@ func TestReconcile(t *testing.T) { WorkspaceType: instance.Type, WorkspaceClass: instance.WorkspaceClass, ContextURL: instance.ContextURL, - StartTime: common_db.TimeToISO8601(instance.StartedTime.Time()), + StartTime: db.TimeToISO8601(instance.StartedTime.Time()), EndTime: "", UserName: instance.UserName, UserAvatarURL: instance.UserAvatarURL, @@ -178,7 +177,7 @@ func TestReconcile(t *testing.T) { WorkspaceClass: db.WorkspaceClass_Default, Type: db.WorkspaceType_Regular, UsageAttributionID: db.NewTeamAttributionID(uuid.New().String()), - StartedTime: common_db.NewVarCharTime(now.Add(1 * time.Minute)), + StartedTime: db.NewVarCharTime(now.Add(1 * time.Minute)), } // the fields in the usage record deliberately do not match the instance, except for the Instance ID. @@ -188,7 +187,7 @@ func TestReconcile(t *testing.T) { AttributionID: db.NewUserAttributionID(uuid.New().String()), Description: "Some description", CreditCents: 1, - EffectiveTime: common_db.VarcharTime{}, + EffectiveTime: db.VarcharTime{}, Kind: db.WorkspaceInstanceUsageKind, WorkspaceInstanceID: &instance.ID, Draft: true, @@ -205,7 +204,7 @@ func TestReconcile(t *testing.T) { AttributionID: instance.UsageAttributionID, Description: usageDescriptionFromController, CreditCents: db.NewCreditCents(pricer.CreditsUsedByInstance(&instance, now)), - EffectiveTime: common_db.NewVarCharTime(now), + EffectiveTime: db.NewVarCharTime(now), Kind: db.WorkspaceInstanceUsageKind, WorkspaceInstanceID: &instance.ID, Draft: true, @@ -216,7 +215,7 @@ func TestReconcile(t *testing.T) { WorkspaceType: instance.Type, WorkspaceClass: instance.WorkspaceClass, ContextURL: instance.ContextURL, - StartTime: common_db.TimeToISO8601(instance.StartedTime.Time()), + StartTime: db.TimeToISO8601(instance.StartedTime.Time()), EndTime: "", UserName: instance.UserName, UserAvatarURL: instance.UserAvatarURL, @@ -273,34 +272,34 @@ func TestListUsage(t *testing.T) { draftBefore := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), CreditCents: 100, Draft: true, }) nondraftBefore := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(-1 * 23 * time.Hour)), CreditCents: 200, Draft: false, }) draftInside := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), CreditCents: 300, Draft: true, }) nonDraftInside := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(start.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(start.Add(2 * time.Hour)), CreditCents: 400, Draft: false, }) nonDraftAfter := dbtest.NewUsage(t, db.Usage{ AttributionID: attributionID, - EffectiveTime: common_db.NewVarCharTime(end.Add(2 * time.Hour)), + EffectiveTime: db.NewVarCharTime(end.Add(2 * time.Hour)), CreditCents: 1000, }) diff --git a/components/usage/pkg/server/server.go b/components/usage/pkg/server/server.go index 79047207950a71..022993bfed55e6 100644 --- a/components/usage/pkg/server/server.go +++ b/components/usage/pkg/server/server.go @@ -18,11 +18,10 @@ import ( "google.golang.org/grpc/credentials/insecure" "github.com/gitpod-io/gitpod/common-go/baseserver" - common_db "github.com/gitpod-io/gitpod/common-go/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/log" v1 "github.com/gitpod-io/gitpod/usage-api/v1" "github.com/gitpod-io/gitpod/usage/pkg/apiv1" - "github.com/gitpod-io/gitpod/usage/pkg/db" "github.com/gitpod-io/gitpod/usage/pkg/stripe" "gorm.io/gorm" ) @@ -51,7 +50,7 @@ type Config struct { func Start(cfg Config, version string) error { log.WithField("config", cfg).Info("Starting usage component.") - conn, err := common_db.Connect(common_db.ConnectionParams{ + conn, err := db.Connect(db.ConnectionParams{ User: os.Getenv("DB_USERNAME"), Password: os.Getenv("DB_PASSWORD"), Host: net.JoinHostPort(os.Getenv("DB_HOST"), os.Getenv("DB_PORT")), diff --git a/components/usage/pkg/stripe/stripe.go b/components/usage/pkg/stripe/stripe.go index a531d3c86a22e2..e8c4ce8fb2dbbd 100644 --- a/components/usage/pkg/stripe/stripe.go +++ b/components/usage/pkg/stripe/stripe.go @@ -14,10 +14,10 @@ import ( "strings" "time" - "github.com/gitpod-io/gitpod/usage/pkg/db" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/log" "github.com/stripe/stripe-go/v72" "github.com/stripe/stripe-go/v72/client" diff --git a/components/usage/pkg/stripe/stripe_test.go b/components/usage/pkg/stripe/stripe_test.go index c3e9e4cb79dfa5..2313ae7e6c4b02 100644 --- a/components/usage/pkg/stripe/stripe_test.go +++ b/components/usage/pkg/stripe/stripe_test.go @@ -8,8 +8,7 @@ import ( "fmt" "testing" - "github.com/gitpod-io/gitpod/usage/pkg/db" - + "github.com/gitpod-io/gitpod/common-go/db" "github.com/stretchr/testify/require" ) diff --git a/install/installer/go.mod b/install/installer/go.mod index 4761c244267969..982adf17fb3088 100644 --- a/install/installer/go.mod +++ b/install/installer/go.mod @@ -302,7 +302,7 @@ require ( gopkg.in/ini.v1 v1.63.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gorm.io/datatypes v1.0.6 // indirect + gorm.io/datatypes v1.0.7 // indirect gorm.io/driver/mysql v1.4.4 // indirect gorm.io/gorm v1.24.1 // indirect honnef.co/go/tools v0.2.2 // indirect diff --git a/install/installer/go.sum b/install/installer/go.sum index ffac3977c30ec5..da82f2bb8451a3 100644 --- a/install/installer/go.sum +++ b/install/installer/go.sum @@ -1113,7 +1113,6 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.10.1/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= github.com/jackc/pgconn v1.11.0 h1:HiHArx4yFbwl91X3qqIHtUFoiIfLNJXCQRsnzkiwwaQ= github.com/jackc/pgconn v1.11.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= @@ -1139,20 +1138,17 @@ github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01C github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.9.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgtype v1.10.0 h1:ILnBWrRMSXGczYvmkYD6PsYyVFUNLTnIUJHHDLmqk38= github.com/jackc/pgtype v1.10.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.14.1/go.mod h1:RgDuE4Z34o7XE92RpLsvFiOEfrAUT0Xt2KxvX73W06M= github.com/jackc/pgx/v4 v4.15.0 h1:B7dTkXsdILD3MF987WGGCcg+tvLW6bZJdEcqVFeU//w= github.com/jackc/pgx/v4 v4.15.0/go.mod h1:D/zyOyXiaM1TmVWnOM18p0xdDtdakRBa0RsVGI3U3bw= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.2.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= @@ -2982,19 +2978,19 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/datatypes v1.0.6 h1:3cqbakp1DIgC+P7wyODb5k+lSjW8g3mjkg/BIsmhjlE= -gorm.io/datatypes v1.0.6/go.mod h1:Gh/Xd/iUWWybMEk8CzYCK/swqlni2r+ROeM1HGIM0ck= +gorm.io/datatypes v1.0.7 h1:8NhJN4+annFjwV1WufDhFiPjdUvV1lSGUdg1UCjQIWY= +gorm.io/datatypes v1.0.7/go.mod h1:l9qkCuy0CdzDEop9HKUdcnC9gHC2sRlaFtHkTzsZRqg= gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/driver/mysql v1.4.4 h1:MX0K9Qvy0Na4o7qSC/YI7XxqUw5KDw01umqgID+svdQ= gorm.io/driver/mysql v1.4.4/go.mod h1:BCg8cKI+R0j/rZRQxeKis/forqRwRSYOR8OM3Wo6hOM= -gorm.io/driver/postgres v1.3.1 h1:Pyv+gg1Gq1IgsLYytj/S2k7ebII3CzEdpqQkPOdH24g= -gorm.io/driver/postgres v1.3.1/go.mod h1:WwvWOuR9unCLpGWCL6Y3JOeBWvbKi6JLhayiVclSZZU= +gorm.io/driver/postgres v1.3.4 h1:evZ7plF+Bp+Lr1mO5NdPvd6M/N98XtwHixGB+y7fdEQ= +gorm.io/driver/postgres v1.3.4/go.mod h1:y0vEuInFKJtijuSGu9e5bs5hzzSzPK+LancpKpvbRBw= gorm.io/driver/sqlite v1.3.1 h1:bwfE+zTEWklBYoEodIOIBwuWHpnx52Z9zJFW5F33WLk= gorm.io/driver/sqlite v1.3.1/go.mod h1:wJx0hJspfycZ6myN38x1O/AqLtNS6c5o9TndewFbELg= gorm.io/driver/sqlserver v1.3.1 h1:F5t6ScMzOgy1zukRTIZgLZwKahgt3q1woAILVolKpOI= gorm.io/driver/sqlserver v1.3.1/go.mod h1:w25Vrx2BG+CJNUu/xKbFhaKlGxT/nzRkhWCCoptX8tQ= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.23.2/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.24.1 h1:CgvzRniUdG67hBAzsxDGOAuq4Te1osVMYsa1eQbd4fs= gorm.io/gorm v1.24.1/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= diff --git a/install/installer/pkg/components/usage/configmap.go b/install/installer/pkg/components/usage/configmap.go index caeec3be784827..a84a5103e4c62e 100644 --- a/install/installer/pkg/components/usage/configmap.go +++ b/install/installer/pkg/components/usage/configmap.go @@ -8,7 +8,7 @@ import ( "time" "github.com/gitpod-io/gitpod/common-go/baseserver" - "github.com/gitpod-io/gitpod/usage/pkg/db" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/usage/pkg/server" "github.com/gitpod-io/gitpod/usage/pkg/stripe" diff --git a/install/installer/pkg/config/v1/experimental/experimental.go b/install/installer/pkg/config/v1/experimental/experimental.go index f9a48df2bed4f4..e548e7aafd947e 100644 --- a/install/installer/pkg/config/v1/experimental/experimental.go +++ b/install/installer/pkg/config/v1/experimental/experimental.go @@ -14,8 +14,8 @@ import ( "time" agentSmith "github.com/gitpod-io/gitpod/agent-smith/pkg/config" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/common-go/grpc" - "github.com/gitpod-io/gitpod/usage/pkg/db" "github.com/gitpod-io/gitpod/ws-daemon/pkg/cpulimit" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" From 944ee1c9f55622eaa49ef56d280f2f52ecbe800f Mon Sep 17 00:00:00 2001 From: "Laurie T. Malau" Date: Thu, 17 Nov 2022 09:14:09 +0000 Subject: [PATCH 2/2] Fix error --- install/installer/pkg/components/usage/configmap_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installer/pkg/components/usage/configmap_test.go b/install/installer/pkg/components/usage/configmap_test.go index c7c21a13112484..8c71dccb95b51f 100644 --- a/install/installer/pkg/components/usage/configmap_test.go +++ b/install/installer/pkg/components/usage/configmap_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" + "github.com/gitpod-io/gitpod/common-go/db" "github.com/gitpod-io/gitpod/installer/pkg/common" config "github.com/gitpod-io/gitpod/installer/pkg/config/v1" "github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental" "github.com/gitpod-io/gitpod/installer/pkg/config/versions" - "github.com/gitpod-io/gitpod/usage/pkg/db" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" )