|
|
@ -50,7 +50,7 @@ func TestStatusCmd(t *testing.T) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "get status of a deployed release",
|
|
|
|
name: "get status of a deployed release",
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
expected: outputWithStatus("DEPLOYED\n\n"),
|
|
|
|
expected: outputWithStatus("DEPLOYED", username+"\n\n"),
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
@ -58,7 +58,7 @@ func TestStatusCmd(t *testing.T) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "get status of a deployed release with notes",
|
|
|
|
name: "get status of a deployed release with notes",
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
expected: outputWithStatus("DEPLOYED\n\nNOTES:\nrelease notes\n"),
|
|
|
|
expected: outputWithStatus("DEPLOYED", username+"\n\nNOTES:\nrelease notes\n"),
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
|
Notes: "release notes",
|
|
|
|
Notes: "release notes",
|
|
|
@ -67,7 +67,7 @@ func TestStatusCmd(t *testing.T) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "get status of a deployed release with resources",
|
|
|
|
name: "get status of a deployed release with resources",
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
expected: outputWithStatus("DEPLOYED\n\nRESOURCES:\nresource A\nresource B\n\n"),
|
|
|
|
expected: outputWithStatus("DEPLOYED", username+"\n\nRESOURCES:\nresource A\nresource B\n\n"),
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
|
Resources: "resource A\nresource B\n",
|
|
|
|
Resources: "resource A\nresource B\n",
|
|
|
@ -76,10 +76,10 @@ func TestStatusCmd(t *testing.T) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "get status of a deployed release with test suite",
|
|
|
|
name: "get status of a deployed release with test suite",
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
args: []string{"flummoxed-chickadee"},
|
|
|
|
expected: outputWithStatus(
|
|
|
|
expected: outputWithStatus("DEPLOYED",
|
|
|
|
fmt.Sprintf("DEPLOYED\n\nTEST SUITE:\nLast Started: %s\nLast Completed: %s\n\n", dateString, dateString) +
|
|
|
|
fmt.Sprintf("%s\n\nTEST SUITE:\nLast Started: %s\nLast Completed: %s\n\n", username, dateString, dateString)+
|
|
|
|
fmt.Sprint("TEST \tSTATUS \tINFO \tSTARTED \tCOMPLETED \n") +
|
|
|
|
fmt.Sprint("TEST \tSTATUS \tINFO \tSTARTED \tCOMPLETED \n")+
|
|
|
|
fmt.Sprintf("test run 1\tSUCCESS \textra info\t%s\t%s\n", dateString, dateString) +
|
|
|
|
fmt.Sprintf("test run 1\tSUCCESS \textra info\t%s\t%s\n", dateString, dateString)+
|
|
|
|
fmt.Sprintf("test run 2\tFAILURE \t \t%s\t%s\n", dateString, dateString)),
|
|
|
|
fmt.Sprintf("test run 2\tFAILURE \t \t%s\t%s\n", dateString, dateString)),
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
rel: releaseMockWithStatus(&release.Status{
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
|
Code: release.Status_DEPLOYED,
|
|
|
@ -131,10 +131,11 @@ func TestStatusCmd(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func outputWithStatus(status string) string {
|
|
|
|
func outputWithStatus(status string, username string) string {
|
|
|
|
return fmt.Sprintf("LAST DEPLOYED: %s\nNAMESPACE: \nSTATUS: %s",
|
|
|
|
return fmt.Sprintf("LAST DEPLOYED: %s\nNAMESPACE: \nSTATUS: %s\nRELEASED BY: %s",
|
|
|
|
dateString,
|
|
|
|
dateString,
|
|
|
|
status)
|
|
|
|
status,
|
|
|
|
|
|
|
|
username)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func releaseMockWithStatus(status *release.Status) *release.Release {
|
|
|
|
func releaseMockWithStatus(status *release.Status) *release.Release {
|
|
|
@ -144,6 +145,7 @@ func releaseMockWithStatus(status *release.Status) *release.Release {
|
|
|
|
FirstDeployed: &date,
|
|
|
|
FirstDeployed: &date,
|
|
|
|
LastDeployed: &date,
|
|
|
|
LastDeployed: &date,
|
|
|
|
Status: status,
|
|
|
|
Status: status,
|
|
|
|
|
|
|
|
Username: username,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|