mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-27 00:19:36 -05:00
0969ff4ac3
* Fix license integration test * Fix build tags in lint config * Fix missing error checks * Fix use of MarkNodeAsInitialized * Fix attestation tests * Add license integration test to cmake list
67 lines
1.1 KiB
Go
67 lines
1.1 KiB
Go
//go:build integration
|
|
|
|
package license
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCheckQuotaIntegration(t *testing.T) {
|
|
testCases := map[string]struct {
|
|
license string
|
|
action Action
|
|
wantQuota int
|
|
wantError bool
|
|
}{
|
|
"ES license has quota 256": {
|
|
license: "***REMOVED***",
|
|
action: test,
|
|
wantQuota: 256,
|
|
},
|
|
"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 := CheckQuotaRequest{
|
|
Action: tc.action,
|
|
License: tc.license,
|
|
}
|
|
resp, err := client.CheckQuota(context.Background(), req)
|
|
|
|
if tc.wantError {
|
|
assert.Error(err)
|
|
return
|
|
}
|
|
assert.NoError(err)
|
|
assert.Equal(tc.wantQuota, resp.Quota)
|
|
})
|
|
}
|
|
}
|