From 50b30e8761f1e0e32681440f5494177aef410ba4 Mon Sep 17 00:00:00 2001 From: Rodrigo V Honorato Date: Wed, 28 Aug 2024 16:17:56 +0200 Subject: [PATCH] update `TestValidateExecutionModes` --- input/input_test.go | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/input/input_test.go b/input/input_test.go index fc562d0..aea8e8b 100644 --- a/input/input_test.go +++ b/input/input_test.go @@ -675,6 +675,7 @@ func TestValidateExecutionModes(t *testing.T) { type fields struct { General GeneralStruct + Slurm SlurmParams Scenarios []Scenario } tests := []struct { @@ -688,6 +689,9 @@ func TestValidateExecutionModes(t *testing.T) { General: GeneralStruct{ HaddockDir: haddock3Dir, }, + Slurm: SlurmParams{ + Cpus_per_task: 42, + }, Scenarios: []Scenario{ { Name: "true-interface", @@ -707,6 +711,9 @@ func TestValidateExecutionModes(t *testing.T) { General: GeneralStruct{ HaddockDir: haddock2Dir, }, + Slurm: SlurmParams{ + Cpus_per_task: 42, + }, Scenarios: []Scenario{}, }, wantErr: true, @@ -717,12 +724,15 @@ func TestValidateExecutionModes(t *testing.T) { General: GeneralStruct{ HaddockDir: haddock3Dir, }, + Slurm: SlurmParams{ + Cpus_per_task: 42, + }, Scenarios: []Scenario{ { Name: "true-interface", Parameters: ParametersStruct{ General: map[string]any{ - "mode": "anything", + "mode": "batch", }, }, }, @@ -730,11 +740,34 @@ func TestValidateExecutionModes(t *testing.T) { }, wantErr: true, }, + { + name: "valid-haddock3", + fields: fields{ + General: GeneralStruct{ + HaddockDir: haddock3Dir, + }, + Slurm: SlurmParams{ + Cpus_per_task: 42, + }, + Scenarios: []Scenario{ + { + Name: "true-interface", + Parameters: ParametersStruct{ + General: map[string]any{ + "mode": "local", + }, + }, + }, + }, + }, + wantErr: false, + }, } for _, tt := range tests { inp := &Input{ General: tt.fields.General, Scenarios: tt.fields.Scenarios, + Slurm: tt.fields.Slurm, } if err := inp.ValidateExecutionModes(); (err != nil) != tt.wantErr { t.Errorf("Input.ValidateExecutionModes() error = %v, wantErr %v", err, tt.wantErr)