Fix guided lifecycle job scoping
This commit is contained in:
@@ -101,6 +101,24 @@ func TestJobExecutionInputModelRoundTripPreservesLifecycleMetadata(t *testing.T)
|
||||
LifecycleOperation: "upgrade",
|
||||
TargetVersion: "2.0.0",
|
||||
Inputs: map[string]string{"templateKey": "players.by-id", "playerId": "steam-123"},
|
||||
Deployment: &domain.ServerDeploymentDefinition{
|
||||
Mode: domain.ServerDeploymentModeGuided,
|
||||
ProfileKey: "run-local",
|
||||
RuntimeBindings: map[string]string{"installRoot": "D:\\scumserver"},
|
||||
CreateInputs: map[string]string{"gamePort": "27000", "maxPlayers": "128"},
|
||||
ServerRoot: "D:\\scumserver",
|
||||
WorkingDirectory: "D:\\scumserver",
|
||||
InstallCommand: "install.cmd",
|
||||
StartCommand: "start.cmd",
|
||||
Shell: domain.ServerCommandShellCmd,
|
||||
Revision: 3,
|
||||
},
|
||||
ServerDeploymentPlan: &domain.ServerDeploymentPlan{
|
||||
SchemaVersion: "1",
|
||||
Operation: "install",
|
||||
PluginID: "game.scum",
|
||||
Prerequisites: []domain.RuntimeServerPrerequisite{{Key: "steamcmd", Kind: "tool"}},
|
||||
},
|
||||
}
|
||||
|
||||
row := executionInputFromDomain(source)
|
||||
@@ -108,20 +126,31 @@ func TestJobExecutionInputModelRoundTripPreservesLifecycleMetadata(t *testing.T)
|
||||
if row.Inputs["playerId"] != "steam-123" {
|
||||
t.Fatalf("expected model execution inputs to be isolated from source mutation, row=%+v", row.Inputs)
|
||||
}
|
||||
source.Deployment.CreateInputs["maxPlayers"] = "64"
|
||||
if row.Deployment == nil || row.Deployment.CreateInputs["maxPlayers"] != "128" {
|
||||
t.Fatalf("expected model deployment inputs to be isolated from source mutation, row=%+v", row.Deployment)
|
||||
}
|
||||
source.Inputs["playerId"] = "steam-123"
|
||||
source.Deployment.CreateInputs["maxPlayers"] = "128"
|
||||
row.Inputs["playerId"] = "row-mutated"
|
||||
if source.Inputs["playerId"] != "steam-123" {
|
||||
t.Fatalf("expected source execution inputs to be isolated from model mutation, source=%+v", source.Inputs)
|
||||
}
|
||||
row.Deployment.CreateInputs["maxPlayers"] = "32"
|
||||
if source.Deployment.CreateInputs["maxPlayers"] != "128" {
|
||||
t.Fatalf("expected source deployment inputs to be isolated from model mutation, source=%+v", source.Deployment)
|
||||
}
|
||||
row.Inputs["playerId"] = "steam-123"
|
||||
row.Deployment.CreateInputs["maxPlayers"] = "128"
|
||||
|
||||
roundTrip := row.ToDomain()
|
||||
if !reflect.DeepEqual(roundTrip, source) {
|
||||
t.Fatalf("expected lifecycle execution metadata to round-trip, got %+v", roundTrip)
|
||||
}
|
||||
roundTrip.Inputs["playerId"] = "mutated"
|
||||
if source.Inputs["playerId"] != "steam-123" || row.Inputs["playerId"] != "steam-123" {
|
||||
t.Fatalf("expected execution inputs to round-trip without aliasing, source=%+v row=%+v", source.Inputs, row.Inputs)
|
||||
roundTrip.Deployment.CreateInputs["maxPlayers"] = "16"
|
||||
if source.Inputs["playerId"] != "steam-123" || row.Inputs["playerId"] != "steam-123" || source.Deployment.CreateInputs["maxPlayers"] != "128" || row.Deployment.CreateInputs["maxPlayers"] != "128" {
|
||||
t.Fatalf("expected execution inputs to round-trip without aliasing, source=%+v row=%+v", source, row)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user