From 7e78d4a60730678118839762d86c357bf9dcd32d Mon Sep 17 00:00:00 2001 From: Drew Bailey Date: Fri, 26 Mar 2021 13:21:47 -0400 Subject: [PATCH] e2e license smoke test (#10242) --- e2e/e2e_test.go | 1 + e2e/license/license.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 e2e/license/license.go diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index fe3f4077c..3c4998218 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -19,6 +19,7 @@ import ( _ "github.com/hashicorp/nomad/e2e/events" _ "github.com/hashicorp/nomad/e2e/example" _ "github.com/hashicorp/nomad/e2e/isolation" + _ "github.com/hashicorp/nomad/e2e/license" _ "github.com/hashicorp/nomad/e2e/lifecycle" _ "github.com/hashicorp/nomad/e2e/metrics" _ "github.com/hashicorp/nomad/e2e/namespaces" diff --git a/e2e/license/license.go b/e2e/license/license.go new file mode 100644 index 000000000..c4efb3278 --- /dev/null +++ b/e2e/license/license.go @@ -0,0 +1,33 @@ +package license + +import ( + "github.com/hashicorp/nomad/api" + "github.com/hashicorp/nomad/e2e/framework" + "github.com/stretchr/testify/require" +) + +type LicenseE2ETest struct { + framework.TC +} + +func init() { + framework.AddSuites(&framework.TestSuite{ + Component: "License", + CanRunLocal: true, + Cases: []framework.TestCase{new(LicenseE2ETest)}, + }) +} + +func (tc *LicenseE2ETest) TestLicenseGet(f *framework.F) { + t := f.T() + + client := tc.Nomad() + + // Get the license and do not forward to the leader + lic, _, err := client.Operator().LicenseGet(&api.QueryOptions{ + AllowStale: true, + }) + + require.NoError(t, err) + require.NotEqual(t, "temporary-license", lic.License.LicenseID) +}