Skip to content

Commit

Permalink
refactor: change runs subcommand tree to status
Browse files Browse the repository at this point in the history
This also renames runs `status` to status `dashboard`

Signed-off-by: Nick Mitchell <[email protected]>
  • Loading branch information
starpit committed Sep 26, 2024
1 parent ccdec86 commit 0ea17f3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions cmd/subcommands/runs.go → cmd/subcommands/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ package subcommands
import (
"github.com/spf13/cobra"

"lunchpail.io/cmd/subcommands/runs"
"lunchpail.io/cmd/subcommands/status"
"lunchpail.io/pkg/build"
)

func init() {
if build.IsBuilt() {
cmd := &cobra.Command{
Use: "runs",
Short: "Commands related to runs",
Use: "status",
Short: "Commands related to run status",
}

rootCmd.AddCommand(cmd)
cmd.AddCommand(runs.Status())
cmd.AddCommand(runs.List())
cmd.AddCommand(runs.Dashboard())
cmd.AddCommand(runs.ListRuns())
cmd.AddCommand(runs.Instances())
cmd.AddCommand(runs.Cpu())
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
"lunchpail.io/pkg/observe/status"
)

func Status() *cobra.Command {
func Dashboard() *cobra.Command {
var watchFlag bool
var summaryFlag bool
var loglinesFlag int
var intervalFlag int

var cmd = &cobra.Command{
Use: "status",
Short: "Status of a run",
Use: "dashboard",
Short: "Show a console-based dashboard for a run",
}

cmd.Flags().BoolVarP(&watchFlag, "watch", "w", false, "Track updates to run status")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
"lunchpail.io/pkg/be/runs"
)

func List() *cobra.Command {
func ListRuns() *cobra.Command {
var all bool
var name bool
var latest bool

var cmd = &cobra.Command{
Use: "list",
Use: "runs",
Short: "List recent runs",
Args: cobra.MatchAll(cobra.ExactArgs(0), cobra.OnlyValidArgs),
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bin/add-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -eo pipefail

# Wait for minio component
echo "$(tput setaf 2)Pre-Populating s3 app=$testapp target=${LUNCHPAIL_TARGET:-kubernetes} (waiting for s3 to be ready)$(tput sgr0)"
$testapp runs instances \
$testapp status instances \
--namespace $NAMESPACE \
--target ${LUNCHPAIL_TARGET:-kubernetes} \
--component minio \
Expand Down
6 changes: 3 additions & 3 deletions tests/bin/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function waitForIt {

# Note: we will use --run $run_name in a few places, but not all
# -- intentionally so we have test coverage of both code paths
local run_name=$($testapp runs list --target ${LUNCHPAIL_TARGET:-kubernetes} -n $ns --latest --name)
local run_name=$($testapp status runs --target ${LUNCHPAIL_TARGET:-kubernetes} -n $ns --latest --name)
if [ -n "$run_name" ]
then echo "✅ PASS found run_name test=$name run_name=$run_name"
else echo "❌ FAIL empty run_name test=$name" && return 1
Expand Down Expand Up @@ -168,7 +168,7 @@ function waitForNoInstances {
echo "Checking that no $component remain running for run=$run_name"
while true
do
nRunning=$($testapp runs instances --run $run_name --target ${LUNCHPAIL_TARGET:-kubernetes} --component $component -n $ns)
nRunning=$($testapp status instances --run $run_name --target ${LUNCHPAIL_TARGET:-kubernetes} --component $component -n $ns)
if [[ $nRunning == 0 ]]
then echo "✅ PASS run-controller test=$name no $component remain running" && break
else echo "$nRunning ${component}(s) remaining running" && sleep 2
Expand Down Expand Up @@ -253,7 +253,7 @@ function waitForUnassignedAndOutbox {
done
echo "✅ PASS run-controller run test $name"

local run_name=$($testapp runs list --target ${LUNCHPAIL_TARGET:-kubernetes} -n $ns --latest --name)
local run_name=$($testapp status runs --target ${LUNCHPAIL_TARGET:-kubernetes} -n $ns --latest --name)
echo "✅ PASS run-controller found run test=$name"

waitForEveryoneToDie $run_name
Expand Down

0 comments on commit 0ea17f3

Please sign in to comment.