mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-22 23:10:36 -04:00

* deps: update Go to v1.24.2 * tests: replace context.Background() with t.Context() --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems>
51 lines
991 B
Go
51 lines
991 B
Go
//go:build integration
|
|
|
|
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package integration
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
|
"github.com/edgelesssys/constellation/v2/internal/license"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestQuotaCheckIntegration(t *testing.T) {
|
|
testCases := map[string]struct {
|
|
license string
|
|
wantQuota int
|
|
wantError bool
|
|
}{
|
|
"OSS license has quota 8": {
|
|
license: license.CommunityLicense,
|
|
wantQuota: 8,
|
|
},
|
|
"Empty license assumes community": {
|
|
license: "",
|
|
wantQuota: 8,
|
|
},
|
|
}
|
|
|
|
for name, tc := range testCases {
|
|
t.Run(name, func(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
client := license.NewChecker()
|
|
|
|
quota, err := client.CheckLicense(t.Context(), cloudprovider.Unknown, "test", tc.license)
|
|
|
|
if tc.wantError {
|
|
assert.Error(err)
|
|
return
|
|
}
|
|
assert.NoError(err)
|
|
assert.Equal(tc.wantQuota, quota)
|
|
})
|
|
}
|
|
}
|