mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Merge 1a91f9b3f1 into 94d5023846
This commit is contained in:
commit
ccce843531
7 changed files with 22 additions and 10 deletions
|
|
@ -490,5 +490,5 @@ data:
|
|||
is.NoError(err)
|
||||
|
||||
// Verify that WaitOptions were passed to GetWaiter
|
||||
is.NotEmpty(failer.RecordedWaitOptions, "WaitOptions should be passed to GetWaiter")
|
||||
is.NotEmpty(failer.GetRecordedWaitOptions(), "WaitOptions should be passed to GetWaiter")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1295,5 +1295,5 @@ func TestInstallRelease_WaitOptionsPassedDownstream(t *testing.T) {
|
|||
is.NoError(err)
|
||||
|
||||
// Verify that WaitOptions were passed to GetWaiter
|
||||
is.NotEmpty(failer.RecordedWaitOptions, "WaitOptions should be passed to GetWaiter")
|
||||
is.NotEmpty(failer.GetRecordedWaitOptions(), "WaitOptions should be passed to GetWaiter")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ func TestReleaseTesting_WaitOptionsPassedDownstream(t *testing.T) {
|
|||
is.NoError(err)
|
||||
|
||||
// Verify that WaitOptions were passed to GetWaiter
|
||||
is.NotEmpty(failer.RecordedWaitOptions, "WaitOptions should be passed to GetWaiter")
|
||||
is.NotEmpty(failer.GetRecordedWaitOptions(), "WaitOptions should be passed to GetWaiter")
|
||||
}
|
||||
|
||||
func TestGetContainerLogs_MultipleContainers(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -81,5 +81,5 @@ func TestRollback_WaitOptionsPassedDownstream(t *testing.T) {
|
|||
is.NoError(err)
|
||||
|
||||
// Verify that WaitOptions were passed to GetWaiter
|
||||
is.NotEmpty(failer.RecordedWaitOptions, "WaitOptions should be passed to GetWaiter")
|
||||
is.NotEmpty(failer.GetRecordedWaitOptions(), "WaitOptions should be passed to GetWaiter")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,5 +204,5 @@ func TestUninstall_WaitOptionsPassedDownstream(t *testing.T) {
|
|||
is.NoError(err)
|
||||
|
||||
// Verify that WaitOptions were passed to GetWaiter
|
||||
is.NotEmpty(failer.RecordedWaitOptions, "WaitOptions should be passed to GetWaiter")
|
||||
is.NotEmpty(failer.GetRecordedWaitOptions(), "WaitOptions should be passed to GetWaiter")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -800,5 +800,5 @@ func TestUpgradeRelease_WaitOptionsPassedDownstream(t *testing.T) {
|
|||
req.NoError(err)
|
||||
|
||||
// Verify that WaitOptions were passed to GetWaiter
|
||||
is.NotEmpty(failer.RecordedWaitOptions, "WaitOptions should be passed to GetWaiter")
|
||||
is.NotEmpty(failer.GetRecordedWaitOptions(), "WaitOptions should be passed to GetWaiter")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package fake
|
|||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -47,8 +48,9 @@ type FailingKubeClient struct {
|
|||
WaitForDeleteError error
|
||||
WatchUntilReadyError error
|
||||
WaitDuration time.Duration
|
||||
// RecordedWaitOptions stores the WaitOptions passed to GetWaiter for testing
|
||||
RecordedWaitOptions []kube.WaitOption
|
||||
// recordedWaitOptions stores the WaitOptions passed to GetWaiter for testing
|
||||
recordedWaitOptions []kube.WaitOption
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
var _ kube.Interface = &FailingKubeClient{}
|
||||
|
|
@ -158,9 +160,19 @@ func (f *FailingKubeClient) GetWaiter(ws kube.WaitStrategy) (kube.Waiter, error)
|
|||
return f.GetWaiterWithOptions(ws)
|
||||
}
|
||||
|
||||
// GetRecordedWaitOptions returns the recorded WaitOptions in a thread-safe manner.
|
||||
func (f *FailingKubeClient) GetRecordedWaitOptions() []kube.WaitOption {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
dst := make([]kube.WaitOption, len(f.recordedWaitOptions))
|
||||
copy(dst, f.recordedWaitOptions)
|
||||
return dst
|
||||
}
|
||||
|
||||
func (f *FailingKubeClient) GetWaiterWithOptions(ws kube.WaitStrategy, opts ...kube.WaitOption) (kube.Waiter, error) {
|
||||
// Record the WaitOptions for testing
|
||||
f.RecordedWaitOptions = append(f.RecordedWaitOptions, opts...)
|
||||
f.mu.Lock()
|
||||
f.recordedWaitOptions = append(f.recordedWaitOptions, opts...)
|
||||
f.mu.Unlock()
|
||||
waiter, _ := f.PrintingKubeClient.GetWaiterWithOptions(ws, opts...)
|
||||
printingKubeWaiter, _ := waiter.(*PrintingKubeWaiter)
|
||||
return &FailingKubeWaiter{
|
||||
|
|
|
|||
Loading…
Reference in a new issue