diff --git a/master/internal/license/license.go b/master/internal/license/license.go index 9008447c5df..2ab58df7c31 100644 --- a/master/internal/license/license.go +++ b/master/internal/license/license.go @@ -1,10 +1,5 @@ package license -const ( - licenseRequiredMsg = "An enterprise license is required to use this feature" - errCheckingLicense = "error when validating license" -) - // licenseKey stores the MLDE licenseKey if provided, else defaulting to no licenseKey. var licenseKey string diff --git a/master/internal/license/license_test.go b/master/internal/license/license_test.go deleted file mode 100644 index 00ea6fc8244..00000000000 --- a/master/internal/license/license_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package license - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -const ( - testResource = "test resource" -) - -func TestRequireLicenseWithEmptyLicenseKey(t *testing.T) { - licenseKey = "" - - defer func() { - if r := recover(); r != nil { - require.Contains(t, r, licenseRequiredMsg) - require.Contains(t, r, testResource) - return - } - require.Fail(t, "panic expected") - }() - RequireLicense(testResource) -} - -func TestRequireLicenseWithEmptyPublicKey(t *testing.T) { - publicKey = "" - - defer func() { - if r := recover(); r != nil { - require.Contains(t, r, licenseRequiredMsg) - require.Contains(t, r, testResource) - return - } - require.Fail(t, "panic expected") - }() - RequireLicense(testResource) -} - -func TestRequireLicenseWithInvalidPublicKey(t *testing.T) { - publicKey = "badKey" - licenseKey = "fakeLicense" - defer func() { - if r := recover(); r != nil { - require.Contains(t, r, errCheckingLicense) - } - }() - RequireLicense(testResource) -} - -func TestRequireLicenseWithInvalidLicenseKey(t *testing.T) { - publicKey = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0" + - "RRZ0FFTkRVTlV3cG82RkpoOWl5Ni8ySC9wTUFyRGxXYQppUUxjNko3QVVYWmFuUzdxbC8xcjZjRDBrbjN2bHV2" + - "MjBxSk1abEVPb1NscEU0WWpKbjQxNzZUWEJnPT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==" - licenseKey = "badLicense" - defer func() { - if r := recover(); r != nil { - require.Contains(t, r, errCheckingLicense) - } - }() - RequireLicense(testResource) -}