Add test for TakeOwnership flag in upgrade --install

Signed-off-by: Karthik babu Manam <karthikmanam@gmail.com>
pull/30657/head
Karthik babu Manam 7 months ago
parent e109fb52c0
commit 5a08ff6832

@ -45,6 +45,10 @@ type FailingKubeClient struct {
BuildDummy bool BuildDummy bool
BuildUnstructuredError error BuildUnstructuredError error
WaitDuration time.Duration WaitDuration time.Duration
// ExistingResources represents resources that already exist in the cluster
ExistingResources []*resource.Info
// ResourcesAdopted tracks how many resources were adopted
ResourcesAdopted int
} }
// Create returns the configured error if set or prints // Create returns the configured error if set or prints
@ -120,6 +124,12 @@ func (f *FailingKubeClient) Build(r io.Reader, _ bool) (kube.ResourceList, error
if f.BuildDummy { if f.BuildDummy {
return createDummyResourceList(), nil return createDummyResourceList(), nil
} }
// If we have existing resources, return them
if len(f.ExistingResources) > 0 {
// Track that resources were adopted
f.ResourcesAdopted++
return f.ExistingResources, nil
}
return f.PrintingKubeClient.Build(r, false) return f.PrintingKubeClient.Build(r, false)
} }

Loading…
Cancel
Save