-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
267 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package enqueue | ||
|
||
import ( | ||
"testing" | ||
|
||
"volcano.sh/volcano/pkg/scheduler/conf" | ||
"volcano.sh/volcano/pkg/scheduler/framework" | ||
) | ||
|
||
func TestGetOverCommitFactor(t *testing.T) { | ||
cases := []struct { | ||
name string | ||
ssn *framework.Session | ||
expectedValue float64 | ||
}{ | ||
{ | ||
name: "arguments of action not exist", | ||
ssn: &framework.Session{ | ||
Configurations: []conf.Configuration{ | ||
{ | ||
Name: "allocate", | ||
Arguments: map[string]string{ | ||
"placeholder": "placeholder", | ||
}, | ||
}, | ||
}, | ||
}, | ||
expectedValue: 1.2, | ||
}, | ||
{ | ||
name: "arguments of action exist", | ||
ssn: &framework.Session{ | ||
Configurations: []conf.Configuration{ | ||
{ | ||
Name: "enqueue", | ||
Arguments: map[string]string{ | ||
overCommitFactor: "2", | ||
}, | ||
}, | ||
}, | ||
}, | ||
expectedValue: 2, | ||
}, | ||
} | ||
|
||
enqueue := New() | ||
for index, c := range cases { | ||
factor := enqueue.getOverCommitFactor(c.ssn) | ||
if factor != c.expectedValue { | ||
t.Errorf("index %d, case %s, expected %v, but got %v", index, c.name, c.expectedValue, factor) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.