github.com/argoproj/argo-cd@v1.8.7/pkg/client/clientset/versioned/fake/clientset_generated.go (about)

     1  // Code generated by client-gen. DO NOT EDIT.
     2  
     3  package fake
     4  
     5  import (
     6  	clientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
     7  	argoprojv1alpha1 "github.com/argoproj/argo-cd/pkg/client/clientset/versioned/typed/application/v1alpha1"
     8  	fakeargoprojv1alpha1 "github.com/argoproj/argo-cd/pkg/client/clientset/versioned/typed/application/v1alpha1/fake"
     9  	"k8s.io/apimachinery/pkg/runtime"
    10  	"k8s.io/apimachinery/pkg/watch"
    11  	"k8s.io/client-go/discovery"
    12  	fakediscovery "k8s.io/client-go/discovery/fake"
    13  	"k8s.io/client-go/testing"
    14  )
    15  
    16  // NewSimpleClientset returns a clientset that will respond with the provided objects.
    17  // It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
    18  // without applying any validations and/or defaults. It shouldn't be considered a replacement
    19  // for a real clientset and is mostly useful in simple unit tests.
    20  func NewSimpleClientset(objects ...runtime.Object) *Clientset {
    21  	o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
    22  	for _, obj := range objects {
    23  		if err := o.Add(obj); err != nil {
    24  			panic(err)
    25  		}
    26  	}
    27  
    28  	cs := &Clientset{tracker: o}
    29  	cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
    30  	cs.AddReactor("*", "*", testing.ObjectReaction(o))
    31  	cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
    32  		gvr := action.GetResource()
    33  		ns := action.GetNamespace()
    34  		watch, err := o.Watch(gvr, ns)
    35  		if err != nil {
    36  			return false, nil, err
    37  		}
    38  		return true, watch, nil
    39  	})
    40  
    41  	return cs
    42  }
    43  
    44  // Clientset implements clientset.Interface. Meant to be embedded into a
    45  // struct to get a default implementation. This makes faking out just the method
    46  // you want to test easier.
    47  type Clientset struct {
    48  	testing.Fake
    49  	discovery *fakediscovery.FakeDiscovery
    50  	tracker   testing.ObjectTracker
    51  }
    52  
    53  func (c *Clientset) Discovery() discovery.DiscoveryInterface {
    54  	return c.discovery
    55  }
    56  
    57  func (c *Clientset) Tracker() testing.ObjectTracker {
    58  	return c.tracker
    59  }
    60  
    61  var _ clientset.Interface = &Clientset{}
    62  
    63  // ArgoprojV1alpha1 retrieves the ArgoprojV1alpha1Client
    64  func (c *Clientset) ArgoprojV1alpha1() argoprojv1alpha1.ArgoprojV1alpha1Interface {
    65  	return &fakeargoprojv1alpha1.FakeArgoprojV1alpha1{Fake: &c.Fake}
    66  }