Fixed some more tests
This commit is contained in:
parent
a254d664cb
commit
c84a000416
|
@ -46,8 +46,8 @@ func testJob(jobID string) *api.Job {
|
|||
CPU: 100,
|
||||
}).
|
||||
SetLogConfig(&api.LogConfig{
|
||||
MaxFiles: 10,
|
||||
MaxFileSizeMB: 10,
|
||||
MaxFiles: 1,
|
||||
MaxFileSizeMB: 2,
|
||||
})
|
||||
|
||||
group := api.NewTaskGroup("group1", 1).
|
||||
|
|
|
@ -58,10 +58,7 @@ func TestParse(t *testing.T) {
|
|||
Meta: map[string]string{
|
||||
"my-cool-key": "foobar",
|
||||
},
|
||||
LogConfig: &structs.LogConfig{
|
||||
MaxFiles: 10,
|
||||
MaxFileSizeMB: 10,
|
||||
},
|
||||
LogConfig: structs.DefaultLogConfig(),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -116,7 +113,7 @@ func TestParse(t *testing.T) {
|
|||
Resources: &structs.Resources{
|
||||
CPU: 500,
|
||||
MemoryMB: 128,
|
||||
DiskMB: 10,
|
||||
DiskMB: 300,
|
||||
IOPS: 0,
|
||||
Networks: []*structs.NetworkResource{
|
||||
&structs.NetworkResource{
|
||||
|
@ -141,7 +138,7 @@ func TestParse(t *testing.T) {
|
|||
Resources: &structs.Resources{
|
||||
CPU: 500,
|
||||
MemoryMB: 128,
|
||||
DiskMB: 10,
|
||||
DiskMB: 300,
|
||||
IOPS: 30,
|
||||
},
|
||||
Constraints: []*structs.Constraint{
|
||||
|
@ -151,10 +148,7 @@ func TestParse(t *testing.T) {
|
|||
Operand: "=",
|
||||
},
|
||||
},
|
||||
LogConfig: &structs.LogConfig{
|
||||
MaxFiles: 10,
|
||||
MaxFileSizeMB: 10,
|
||||
},
|
||||
LogConfig: structs.DefaultLogConfig(),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1803,8 +1803,10 @@ func (t *Task) Validate() error {
|
|||
}
|
||||
}
|
||||
|
||||
if t.Resources.DiskMB <= (t.LogConfig.MaxFiles * t.LogConfig.MaxFileSizeMB) {
|
||||
mErr.Errors = append(mErr.Errors, fmt.Errorf("log storage exceeds requested disk capacity"))
|
||||
if t.LogConfig != nil && t.Resources != nil {
|
||||
if t.Resources.DiskMB <= (t.LogConfig.MaxFiles * t.LogConfig.MaxFileSizeMB) {
|
||||
mErr.Errors = append(mErr.Errors, fmt.Errorf("log storage exceeds requested disk capacity"))
|
||||
}
|
||||
}
|
||||
return mErr.ErrorOrNil()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue