e2e license smoke test (#10242)

This commit is contained in:
Drew Bailey 2021-03-26 13:21:47 -04:00 committed by GitHub
parent 07831ab455
commit 7e78d4a607
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View file

@ -19,6 +19,7 @@ import (
_ "github.com/hashicorp/nomad/e2e/events" _ "github.com/hashicorp/nomad/e2e/events"
_ "github.com/hashicorp/nomad/e2e/example" _ "github.com/hashicorp/nomad/e2e/example"
_ "github.com/hashicorp/nomad/e2e/isolation" _ "github.com/hashicorp/nomad/e2e/isolation"
_ "github.com/hashicorp/nomad/e2e/license"
_ "github.com/hashicorp/nomad/e2e/lifecycle" _ "github.com/hashicorp/nomad/e2e/lifecycle"
_ "github.com/hashicorp/nomad/e2e/metrics" _ "github.com/hashicorp/nomad/e2e/metrics"
_ "github.com/hashicorp/nomad/e2e/namespaces" _ "github.com/hashicorp/nomad/e2e/namespaces"

33
e2e/license/license.go Normal file
View file

@ -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)
}