Skip to content

Commit

Permalink
Attempt to fix flaky E2E test.
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Rule (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed Oct 16, 2024
1 parent cf2f957 commit 406f3fa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
22 changes: 16 additions & 6 deletions extra/tools/simer/internal/app/simer/simer.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,14 @@ func calculateEnv(stack *schema_kind.StackSpec, model *schema_kind.ModelInstance
if model != nil && model.Runtime != nil && model.Runtime.Env != nil {
for k, v := range *model.Runtime.Env {
if stack.Runtime != nil && stack.Runtime.Stacked != nil && *stack.Runtime.Stacked {
// For stacked models, add additional ENVAR prefixed with Model Name.
key := strings.ToUpper(fmt.Sprintf("%s__%s", model.Name, k))
env[key] = v
if model.Name == "simbus" {
// For simbus, directly set the var.
env[k] = v
} else {
// Stacked, set with name prefix.
key := strings.ToUpper(fmt.Sprintf("%s__%s", model.Name, k))
env[key] = v
}
} else {
// Set the var.
env[k] = v
Expand All @@ -369,9 +374,14 @@ func calculateEnv(stack *schema_kind.StackSpec, model *schema_kind.ModelInstance
continue
}
if stack.Runtime != nil && stack.Runtime.Stacked != nil && *stack.Runtime.Stacked {
// Stacked, set with name prefix.
key := strings.ToUpper(fmt.Sprintf("%s__%s", model.Name, k[1]))
env[key] = m[1]
if model.Name == "simbus" {
// For simbus, directly set the var.
env[k[1]] = m[1]
} else {
// Stacked, set with name prefix.
key := strings.ToUpper(fmt.Sprintf("%s__%s", model.Name, k[1]))
env[key] = m[1]
}
} else {
// Set the var.
env[k[1]] = m[1]
Expand Down
2 changes: 1 addition & 1 deletion tests/testscript/e2e/benchmark.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ SIMER="${SIMER:-ghcr.io/boschglobal/dse-simer:latest}"
END_TIME="${END_TIME:-${DEFAULT_END_TIME}}"
docker run --name simer -i --rm -v $ENTRYHOSTDIR/$SIM:/sim \
$SIMER -valgrind $NAME \
-env $NAME:SIMBUS_LOGLEVEL=2 \
-env SIMBUS_LOGLEVEL=2 \
-endtime $END_TIME \
| tee benchmark_output.txt

Expand Down
25 changes: 7 additions & 18 deletions tests/testscript/e2e/stack.txtar
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Operate from the WORKDIR (allocated by caller, i.e. docker command).
cd $WORKDIR
env SIM=sim
mkdir $SIM/lib $SIM/data
Expand Down Expand Up @@ -96,29 +95,19 @@ stdout 'counter counter_C = 405.000000'
-- test.sh --
SIMER="${SIMER:-ghcr.io/boschglobal/dse-simer:latest}"
docker run --name simer -i --rm -v $ENTRYWORKDIR/$SIM:/sim \
$SIMER -valgrind counter_A \
-env simbus:SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env simbus:SIMBUS_URI=$SIMBUS_URI \
-env counter_A:SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env counter_A:SIMBUS_URI=$SIMBUS_URI \
-env counter_B:SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env counter_B:SIMBUS_URI=$SIMBUS_URI \
-env counter_C:SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env counter_C:SIMBUS_URI=$SIMBUS_URI \
$SIMER -valgrind counter_A -logger 2 \
-env SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env SIMBUS_URI=$SIMBUS_URI \
-env simbus:SIMBUS_LOGLEVEL=2


-- test-loopback.sh --
SIMER="${SIMER:-ghcr.io/boschglobal/dse-simer:latest}"
docker run --name simer -i --rm -v $ENTRYWORKDIR/$SIM:/sim \
$SIMER -valgrind counter_A -simbus="" \
-env counter_A:SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env counter_A:SIMBUS_URI=$SIMBUS_URI \
-env counter_B:SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env counter_B:SIMBUS_URI=$SIMBUS_URI \
-env counter_C:SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env counter_C:SIMBUS_URI=$SIMBUS_URI \
-env counter_C:SIMBUS_LOGLEVEL=2
$SIMER -valgrind counter_A -logger 2 -simbus="" \
-env SIMBUS_TRANSPORT=$SIMBUS_TRANSPORT \
-env SIMBUS_URI=$SIMBUS_URI \
-env SIMBUS_LOGLEVEL=2


-- simulation.yaml --
Expand Down

0 comments on commit 406f3fa

Please sign in to comment.