Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o sim-cli .
FROM ghcr.io/notipswe/notip-go-base:v0.0.1 AS prod

LABEL org.opencontainers.image.source="https://github.com/NoTIPswe/notip-simulator-cli" \
org.opencontainers.image.description="NoTIP Simulator CLI" \
org.opencontainers.image.description="NoTIP Simulator CLI" \
org.opencontainers.image.licenses="MIT"

RUN groupadd -r appuser && useradd -r -g appuser appuser \
Expand Down
6 changes: 3 additions & 3 deletions cmd/anomalies.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var anomaliesDisconnectCmd = &cobra.Command{
spinner := startSpinner(
fmt.Sprintf("Triggering disconnect anomaly on gateway %s (%ds)...", args[0], duration),
)
if err := client.New(simulatorURL).Disconnect(args[0], duration); err != nil {
if err := client.New(simulatorURL).WithContext(cmd.Context()).Disconnect(args[0], duration); err != nil {
spinner.Fail("Failed to trigger disconnect")
return err
}
Expand All @@ -58,7 +58,7 @@ var anomaliesNetworkDegradationCmd = &cobra.Command{
fmt.Sprintf("Triggering network-degradation on gateway %s (%ds, %.0f%% loss)...",
args[0], duration, loss*100),
)
if err := client.New(simulatorURL).InjectNetworkDegradation(args[0], duration, loss); err != nil {
if err := client.New(simulatorURL).WithContext(cmd.Context()).InjectNetworkDegradation(args[0], duration, loss); err != nil {
spinner.Fail("Failed to trigger network degradation")
return err
}
Expand Down Expand Up @@ -88,7 +88,7 @@ var anomaliesOutlierCmd = &cobra.Command{
spinner := startSpinner(
fmt.Sprintf("Injecting outlier into sensor %d...", sensorID),
)
if err := client.New(simulatorURL).InjectOutlier(sensorID, valuePtr); err != nil {
if err := client.New(simulatorURL).WithContext(cmd.Context()).InjectOutlier(sensorID, valuePtr); err != nil {
spinner.Fail("Failed to inject outlier")
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/anomalies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

func TestMustMarkRequired_Success(t *testing.T) {
func TestMustMarkRequiredSuccess(t *testing.T) {
cmd := &cobra.Command{Use: "test"}
cmd.Flags().String("duration", "", "")

Expand All @@ -21,7 +21,7 @@ func TestMustMarkRequired_Success(t *testing.T) {
}
}

func TestMustMarkRequired_ErrorTriggersExit(t *testing.T) {
func TestMustMarkRequiredErrorTriggersExit(t *testing.T) {
cmd := &cobra.Command{Use: "test"}
called := false
code := 0
Expand Down
Loading