mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-18 04:14:33 -05:00
license: dedicated module for integration test
The integration test for the license module depends on network connectivity and should be Bazel-tagged as such. Since the unit tests do not have a network dependency, we should not apply the tag to those. The easiest way to do this in a Gazelle-compliant way is to move the integration test into its own module.
This commit is contained in:
parent
64a05b9dea
commit
6cfc80454a
@ -26,7 +26,6 @@ go_test(
|
|||||||
name = "license_test",
|
name = "license_test",
|
||||||
srcs = [
|
srcs = [
|
||||||
"file_test.go",
|
"file_test.go",
|
||||||
"license_integration_test.go",
|
|
||||||
"license_test.go",
|
"license_test.go",
|
||||||
],
|
],
|
||||||
embed = [":license"],
|
embed = [":license"],
|
||||||
|
13
internal/license/integration/BUILD.bazel
Normal file
13
internal/license/integration/BUILD.bazel
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
load("//bazel/go:go_test.bzl", "go_test")
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "integration_test",
|
||||||
|
srcs = ["license_integration_test.go"],
|
||||||
|
tags = [
|
||||||
|
"requires-network",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//internal/license",
|
||||||
|
"@com_github_stretchr_testify//assert",
|
||||||
|
],
|
||||||
|
)
|
@ -6,12 +6,13 @@ Copyright (c) Edgeless Systems GmbH
|
|||||||
SPDX-License-Identifier: AGPL-3.0-only
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package license
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/edgelesssys/constellation/v2/internal/license"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ func TestQuotaCheckIntegration(t *testing.T) {
|
|||||||
wantError bool
|
wantError bool
|
||||||
}{
|
}{
|
||||||
"OSS license has quota 8": {
|
"OSS license has quota 8": {
|
||||||
license: CommunityLicense,
|
license: license.CommunityLicense,
|
||||||
wantQuota: 8,
|
wantQuota: 8,
|
||||||
},
|
},
|
||||||
"Empty license assumes community": {
|
"Empty license assumes community": {
|
||||||
@ -35,10 +36,10 @@ func TestQuotaCheckIntegration(t *testing.T) {
|
|||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
client := NewClient()
|
client := license.NewClient()
|
||||||
|
|
||||||
req := QuotaCheckRequest{
|
req := license.QuotaCheckRequest{
|
||||||
Action: test,
|
Action: license.Action("test"),
|
||||||
License: tc.license,
|
License: tc.license,
|
||||||
}
|
}
|
||||||
resp, err := client.QuotaCheck(context.Background(), req)
|
resp, err := client.QuotaCheck(context.Background(), req)
|
Loading…
Reference in New Issue
Block a user