satellite/console: fix default limit for free-tier segment usage limit

Free-tier segment usage limit was defined as 150k, not 140k. This change
is correcting that.

https://github.com/storj/team-metainfo/issues/8

Change-Id: I71ec0961930b19fd09b2b996e01acd406a8dcf8f
This commit is contained in:
Michał Niewrzał 2022-01-18 17:08:11 +01:00 committed by Michal Niewrzal
parent a81af2829e
commit 270c6e24f2
3 changed files with 10 additions and 10 deletions

View File

@ -45,7 +45,7 @@ func TestProjectGet(t *testing.T) {
t.Run("OK", func(t *testing.T) {
link := "http://" + address.String() + "/api/projects/" + project.ID.String()
expected := fmt.Sprintf(
`{"id":"%s","name":"%s","description":"%s","partnerId":"%s","userAgent":null,"ownerId":"%s","rateLimit":null,"burstLimit":null,"maxBuckets":null,"createdAt":"%s","memberCount":0,"storageLimit":"25.00 GB","bandwidthLimit":"25.00 GB","segmentLimit":140000}`,
`{"id":"%s","name":"%s","description":"%s","partnerId":"%s","userAgent":null,"ownerId":"%s","rateLimit":null,"burstLimit":null,"maxBuckets":null,"createdAt":"%s","memberCount":0,"storageLimit":"25.00 GB","bandwidthLimit":"25.00 GB","segmentLimit":150000}`,
project.ID.String(),
project.Name,
project.Description,
@ -86,7 +86,7 @@ func TestProjectLimit(t *testing.T) {
linkLimit := "http://" + address.String() + "/api/projects/" + project.ID.String() + "/limit"
t.Run("Get OK", func(t *testing.T) {
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"25.00 GB","bytes":25000000000},"bandwidth":{"amount":"25.00 GB","bytes":25000000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":140000}`, planet.Satellites[0].Config.Console.AuthToken)
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"25.00 GB","bytes":25000000000},"bandwidth":{"amount":"25.00 GB","bytes":25000000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":150000}`, planet.Satellites[0].Config.Console.AuthToken)
})
t.Run("Get Not Found", func(t *testing.T) {
@ -134,7 +134,7 @@ func TestProjectLimit(t *testing.T) {
require.Equal(t, http.StatusOK, response.StatusCode)
require.NoError(t, response.Body.Close())
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.0 TiB","bytes":1099511627776},"bandwidth":{"amount":"25.00 GB","bytes":25000000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":140000}`, planet.Satellites[0].Config.Console.AuthToken)
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.0 TiB","bytes":1099511627776},"bandwidth":{"amount":"25.00 GB","bytes":25000000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":150000}`, planet.Satellites[0].Config.Console.AuthToken)
req, err = http.NewRequestWithContext(ctx, http.MethodPut, linkLimit+"?usage=1GB", nil)
require.NoError(t, err)
@ -145,7 +145,7 @@ func TestProjectLimit(t *testing.T) {
require.Equal(t, http.StatusOK, response.StatusCode)
require.NoError(t, response.Body.Close())
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"25.00 GB","bytes":25000000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":140000}`, planet.Satellites[0].Config.Console.AuthToken)
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"25.00 GB","bytes":25000000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":150000}`, planet.Satellites[0].Config.Console.AuthToken)
})
t.Run("Update Bandwidth", func(t *testing.T) {
@ -158,7 +158,7 @@ func TestProjectLimit(t *testing.T) {
require.Equal(t, http.StatusOK, response.StatusCode)
require.NoError(t, response.Body.Close())
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"1.00 MB","bytes":1000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":140000}`, planet.Satellites[0].Config.Console.AuthToken)
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"1.00 MB","bytes":1000000},"rate":{"rps":0},"maxBuckets":0,"maxSegments":150000}`, planet.Satellites[0].Config.Console.AuthToken)
})
t.Run("Update Rate", func(t *testing.T) {
@ -171,7 +171,7 @@ func TestProjectLimit(t *testing.T) {
require.Equal(t, http.StatusOK, response.StatusCode)
require.NoError(t, response.Body.Close())
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"1.00 MB","bytes":1000000},"rate":{"rps":100},"maxBuckets":0,"maxSegments":140000}`, planet.Satellites[0].Config.Console.AuthToken)
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"1.00 MB","bytes":1000000},"rate":{"rps":100},"maxBuckets":0,"maxSegments":150000}`, planet.Satellites[0].Config.Console.AuthToken)
})
t.Run("Update Buckets", func(t *testing.T) {
@ -184,7 +184,7 @@ func TestProjectLimit(t *testing.T) {
require.Equal(t, http.StatusOK, response.StatusCode)
require.NoError(t, response.Body.Close())
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"1.00 MB","bytes":1000000},"rate":{"rps":100},"maxBuckets":2000,"maxSegments":140000}`, planet.Satellites[0].Config.Console.AuthToken)
assertGet(ctx, t, linkLimit, `{"usage":{"amount":"1.00 GB","bytes":1000000000},"bandwidth":{"amount":"1.00 MB","bytes":1000000},"rate":{"rps":100},"maxBuckets":2000,"maxSegments":150000}`, planet.Satellites[0].Config.Console.AuthToken)
})
t.Run("Update Segment Limit", func(t *testing.T) {

View File

@ -70,7 +70,7 @@ type BandwidthLimitConfig struct {
// SegmentLimitConfig is a configuration struct for default segments per-project usage limits.
type SegmentLimitConfig struct {
Free int64 `help:"the default free-tier segment usage limit" default:"140000"`
Free int64 `help:"the default free-tier segment usage limit" default:"150000"`
Paid int64 `help:"the default paid-tier segment usage limit" default:"1000000"`
}

View File

@ -29,7 +29,7 @@
# admin.console-config.usage-limits.bandwidth.paid: 100.00 TB
# the default free-tier segment usage limit
# admin.console-config.usage-limits.segment.free: 140000
# admin.console-config.usage-limits.segment.free: 150000
# the default paid-tier segment usage limit
# admin.console-config.usage-limits.segment.paid: 1000000
@ -248,7 +248,7 @@ compensation.withheld-percents: 75,75,75,50,50,50,25,25,25,0,0,0,0,0,0
# console.usage-limits.bandwidth.paid: 100.00 TB
# the default free-tier segment usage limit
# console.usage-limits.segment.free: 140000
# console.usage-limits.segment.free: 150000
# the default paid-tier segment usage limit
# console.usage-limits.segment.paid: 1000000