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:
Markus Rudy 2023-11-22 12:44:06 +01:00 committed by Markus Rudy
parent 64a05b9dea
commit 6cfc80454a
3 changed files with 19 additions and 6 deletions

View File

@ -26,7 +26,6 @@ go_test(
name = "license_test",
srcs = [
"file_test.go",
"license_integration_test.go",
"license_test.go",
],
embed = [":license"],

View 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",
],
)

View File

@ -6,12 +6,13 @@ Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package license
package integration
import (
"context"
"testing"
"github.com/edgelesssys/constellation/v2/internal/license"
"github.com/stretchr/testify/assert"
)
@ -22,7 +23,7 @@ func TestQuotaCheckIntegration(t *testing.T) {
wantError bool
}{
"OSS license has quota 8": {
license: CommunityLicense,
license: license.CommunityLicense,
wantQuota: 8,
},
"Empty license assumes community": {
@ -35,10 +36,10 @@ func TestQuotaCheckIntegration(t *testing.T) {
t.Run(name, func(t *testing.T) {
assert := assert.New(t)
client := NewClient()
client := license.NewClient()
req := QuotaCheckRequest{
Action: test,
req := license.QuotaCheckRequest{
Action: license.Action("test"),
License: tc.license,
}
resp, err := client.QuotaCheck(context.Background(), req)