Skip to content

为什么Simulator的Close方法需要创建一个test Pod并且等待其调度结束 #97

@damoye

Description

@damoye

Question

如果在这一行报错了,defer的Close方法会阻塞,因为scheduler还没运行起来,test pod永远不会返回调度结果,因此会阻塞在sim.simulatorStop这个chan上。

复现方法:删除这一行之后,执行测试pkg/simulator/core_test.go,就会阻塞住。
image

如果要修复这个问题,可以在生成Pod之后再NewSimulator。这样如果生成失败,也不需要Close simulator了

但我的疑问是为什么Simulator的Close方法需要创建一个test Pod并且等待其调度结束?去掉test Pod的话会有什么问题?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions