Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Refactor test cases #36

Open
hzy46 opened this issue Mar 3, 2021 · 0 comments
Open

Refactor test cases #36

hzy46 opened this issue Mar 3, 2021 · 0 comments

Comments

@hzy46
Copy link

hzy46 commented Mar 3, 2021

Motivation

  1. Current test cases are mainly located in https://github.com/microsoft/hivedscheduler/blob/v0.3.4/pkg/algorithm/hived_algorithm_test.go . There are a lot of global variables and the code uses a lot of functions to reference them, which causes poor readability.

  2. As we are going to use the v2 schema, old test cases will be out-dated. It is a good time to refactor them.

Proposal

Define a hivedAlgorithmTester interface as follows:

type hivedAlgorithmTester interface {
	SchedulePod(podName string, pgsr v2.PodGroupSchedulingRequest, isDryRun bool)
	AssertPodScheduleSucceed(podName string, psr internal.PodScheduleResult)
	AssertPodScheduleFail(podName string)

	SetAllNodesToHealthy()
	SetAllNodesToBad()
	SetNodeToBad(nodeName string)
	SetAllNodesToHealthy(nodeName string)

	ExecuteCasesFromYaml(yamlFilename string)
}

func NewHivedAlgorithmTester (t *testing.T, configFilePath string) *hivedAlgorithmTester{

}

After this tester is implemented, we will be able to express test cases within a yaml file, e.g.

- method: SchedulePod
  parameters:
  - pod1
  - vc: vc1
    pinnedCellId: "",
    chain: "DGX2-V100-Node"
    priority: 0
    podRootGroup:
      Name: "pod1-group"
      WithinOneCell: ""
      Pods:
        PodMinNumber: 1
        PodMaxNumber: 1
        CellsPerPod:
          CellType: "DGX2-V100-gpu"
          CellNumber: 1
        ContainsCurrentPod: true
  - false
- method: AssertPodScheduleSucceed
  parameters:
  - pod1
  - psr:
      PodWaitInfo:
      PodPreemptInfo:
      PodWaitInfo:
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant