mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
remove duplicate license info (#8496)
This commit is contained in:
@@ -74,8 +74,6 @@ func outputLicenseInfo(ui cli.Ui, lic *api.License, expired bool, validity strin
|
||||
fmt.Sprintf("License ID|%s", lic.LicenseID),
|
||||
fmt.Sprintf("Customer ID|%s", lic.CustomerID),
|
||||
expStr,
|
||||
fmt.Sprintf("License ID|%s", lic.LicenseID),
|
||||
fmt.Sprintf("Customer ID|%s", lic.CustomerID),
|
||||
fmt.Sprintf("Terminates At|%s", lic.TerminationTime.String()),
|
||||
fmt.Sprintf("Datacenter|%s", lic.InstallationID),
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package command
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/nomad/api"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -26,3 +28,30 @@ func TestCommand_LicenseGet_OSSErr(t *testing.T) {
|
||||
require.Contains(t, ui.ErrorWriter.String(), "Nomad Enterprise only endpoint")
|
||||
}
|
||||
}
|
||||
|
||||
func TestOutputLicenseReply(t *testing.T) {
|
||||
now := time.Now()
|
||||
lic := &api.LicenseReply{
|
||||
License: &api.License{
|
||||
LicenseID: "licenseID",
|
||||
CustomerID: "customerID",
|
||||
InstallationID: "*",
|
||||
IssueTime: now,
|
||||
StartTime: now,
|
||||
ExpirationTime: now.Add(1 * time.Hour),
|
||||
TerminationTime: now,
|
||||
Product: "nomad",
|
||||
Flags: map[string]interface{}{
|
||||
"": nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
|
||||
require.Equal(t, 0, OutputLicenseReply(ui, lic))
|
||||
|
||||
out := ui.OutputWriter.String()
|
||||
require.Contains(t, out, "Customer ID")
|
||||
require.Contains(t, out, "License ID")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user