Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/usage/configmap_test.go
2501 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
/// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package usage
6
7
import (
8
"testing"
9
10
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
11
"github.com/stretchr/testify/require"
12
corev1 "k8s.io/api/core/v1"
13
)
14
15
func TestConfigMap_ContainsSchedule(t *testing.T) {
16
ctx := renderContextWithUsageConfig(t, &experimental.UsageConfig{Enabled: true, Schedule: "2m", ResetUsageSchedule: "5m"})
17
18
objs, err := configmap(ctx)
19
require.NoError(t, err)
20
21
cfgmap, ok := objs[0].(*corev1.ConfigMap)
22
require.True(t, ok)
23
24
require.JSONEq(t,
25
`{
26
"controllerSchedule": "2m",
27
"resetUsageSchedule": "5m",
28
"stripeCredentialsFile": "stripe-secret/apikeys",
29
"defaultSpendingLimit": {
30
"forUsers": 1000000000,
31
"forTeams": 1000000000,
32
"minForUsersOnStripe": 0
33
},
34
"stripePrices": {
35
"individualUsagePriceIds": {
36
"eur": "",
37
"usd": ""
38
},
39
"teamUsagePriceIds": {
40
"eur": "",
41
"usd": ""
42
}
43
},
44
"serverAddress": "server.test-namespace.svc.cluster.local:9877",
45
"redis": {
46
"address": "redis.test-namespace.svc.cluster.local:6379"
47
},
48
"server": {
49
"services": {
50
"grpc": {
51
"address": "0.0.0.0:9001"
52
}
53
}
54
},
55
"gitpodHost": "https://test.domain.everything.awesome.is"
56
}`,
57
cfgmap.Data[configJSONFilename],
58
)
59
}
60
61