constellation/internal/license/license_integration_test.go
Fabian Kammel 45beec15f5 AB#2360 enterprise build tag (#397)
* enterprise build switch to disable license checking in default (OSS) version
* remove community license quota
* empty image references on OSS build in config
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
2022-08-25 14:06:29 +02:00

62 lines
1.0 KiB
Go

//go:build integration
package license
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestQuotaCheckIntegration(t *testing.T) {
testCases := map[string]struct {
license string
action Action
wantQuota int
wantError bool
}{
"OSS license has quota 8": {
license: CommunityLicense,
action: test,
wantQuota: 8,
},
"OSS license missing action": {
license: CommunityLicense,
action: "",
wantQuota: 8,
},
"Empty license assumes community": {
license: "",
action: test,
wantQuota: 8,
},
"Empty request": {
license: "",
action: "",
wantQuota: 8,
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
assert := assert.New(t)
client := NewClient()
req := QuotaCheckRequest{
Action: tc.action,
License: tc.license,
}
resp, err := client.QuotaCheck(context.Background(), req)
if tc.wantError {
assert.Error(err)
return
}
assert.NoError(err)
assert.Equal(tc.wantQuota, resp.Quota)
})
}
}