1 回答

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超6個(gè)贊
我終于找到了錯(cuò)誤......它在反應(yīng)堆函數(shù)的資源名稱(chēng)中,我有secret,它應(yīng)該是復(fù)數(shù)secrets......:facepalm:。所以這是代碼的正確版本:
func TestWhenItsNotPossibleToFetchTheSecrets_ThenAnErrorIsReturned(t *testing.T) {
kubeClient := getKubeClient()
kubeClient.CoreV1().(*fakecorev1.FakeCoreV1).
PrependReactor("list", "secrets", func(action testingk8s.Action) (handled bool, ret runtime.Object, err error) {
return true, &v1.SecretList{}, errors.New("error listing secrets")
})
// ...
}
- 1 回答
- 0 關(guān)注
- 107 瀏覽
添加回答
舉報(bào)