Skip to content

Commit

Permalink
update TestValidateExecutionModes
Browse files Browse the repository at this point in the history
  • Loading branch information
rvhonorato committed Aug 28, 2024
1 parent fc5d5b5 commit 50b30e8
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion input/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ func TestValidateExecutionModes(t *testing.T) {

type fields struct {
General GeneralStruct
Slurm SlurmParams
Scenarios []Scenario
}
tests := []struct {
Expand All @@ -688,6 +689,9 @@ func TestValidateExecutionModes(t *testing.T) {
General: GeneralStruct{
HaddockDir: haddock3Dir,
},
Slurm: SlurmParams{
Cpus_per_task: 42,
},
Scenarios: []Scenario{
{
Name: "true-interface",
Expand All @@ -707,6 +711,9 @@ func TestValidateExecutionModes(t *testing.T) {
General: GeneralStruct{
HaddockDir: haddock2Dir,
},
Slurm: SlurmParams{
Cpus_per_task: 42,
},
Scenarios: []Scenario{},
},
wantErr: true,
Expand All @@ -717,24 +724,50 @@ 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",
},
},
},
},
},
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)
Expand Down

0 comments on commit 50b30e8

Please sign in to comment.