Rename imports in tests to remove double import and to improve readability (#3455)
This commit is contained in:
		
							parent
							
								
									ea13873f14
								
							
						
					
					
						commit
						9b51f25800
					
				|  | @ -21,7 +21,7 @@ import ( | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 	"k8s.io/apimachinery/pkg/types" | 	"k8s.io/apimachinery/pkg/types" | ||||||
| 
 | 
 | ||||||
| 	actionsv1alpha1 "github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1" | 	"github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const ( | const ( | ||||||
|  | @ -34,9 +34,9 @@ var _ = Describe("Test AutoScalingListener controller", func() { | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet | 	var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 	var autoscalingListener *actionsv1alpha1.AutoscalingListener | 	var autoscalingListener *v1alpha1.AutoscalingListener | ||||||
| 
 | 
 | ||||||
| 	BeforeEach(func() { | 	BeforeEach(func() { | ||||||
| 		ctx = context.Background() | 		ctx = context.Background() | ||||||
|  | @ -53,12 +53,12 @@ var _ = Describe("Test AutoScalingListener controller", func() { | ||||||
| 
 | 
 | ||||||
| 		min := 1 | 		min := 1 | ||||||
| 		max := 10 | 		max := 10 | ||||||
| 		autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{ | 		autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{ | 			Spec: v1alpha1.AutoscalingRunnerSetSpec{ | ||||||
| 				GitHubConfigUrl:    "https://github.com/owner/repo", | 				GitHubConfigUrl:    "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret: configSecret.Name, | 				GitHubConfigSecret: configSecret.Name, | ||||||
| 				MaxRunners:         &max, | 				MaxRunners:         &max, | ||||||
|  | @ -79,12 +79,12 @@ var _ = Describe("Test AutoScalingListener controller", func() { | ||||||
| 		err = k8sClient.Create(ctx, autoscalingRunnerSet) | 		err = k8sClient.Create(ctx, autoscalingRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | ||||||
| 
 | 
 | ||||||
| 		autoscalingListener = &actionsv1alpha1.AutoscalingListener{ | 		autoscalingListener = &v1alpha1.AutoscalingListener{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asl", | 				Name:      "test-asl", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingListenerSpec{ | 			Spec: v1alpha1.AutoscalingListenerSpec{ | ||||||
| 				GitHubConfigUrl:               "https://github.com/owner/repo", | 				GitHubConfigUrl:               "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret:            configSecret.Name, | 				GitHubConfigSecret:            configSecret.Name, | ||||||
| 				RunnerScaleSetId:              1, | 				RunnerScaleSetId:              1, | ||||||
|  | @ -119,7 +119,7 @@ var _ = Describe("Test AutoScalingListener controller", func() { | ||||||
| 			).Should(Succeed(), "Config secret should be created") | 			).Should(Succeed(), "Config secret should be created") | ||||||
| 
 | 
 | ||||||
| 			// Check if finalizer is added
 | 			// Check if finalizer is added
 | ||||||
| 			created := new(actionsv1alpha1.AutoscalingListener) | 			created := new(v1alpha1.AutoscalingListener) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (string, error) { | 				func() (string, error) { | ||||||
| 					err := k8sClient.Get(ctx, client.ObjectKey{Name: autoscalingListener.Name, Namespace: autoscalingListener.Namespace}, created) | 					err := k8sClient.Get(ctx, client.ObjectKey{Name: autoscalingListener.Name, Namespace: autoscalingListener.Namespace}, created) | ||||||
|  | @ -298,7 +298,7 @@ var _ = Describe("Test AutoScalingListener controller", func() { | ||||||
| 			// The AutoScalingListener should be deleted
 | 			// The AutoScalingListener should be deleted
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
| 					listenerList := new(actionsv1alpha1.AutoscalingListenerList) | 					listenerList := new(v1alpha1.AutoscalingListenerList) | ||||||
| 					err := k8sClient.List(ctx, listenerList, client.InNamespace(autoscalingListener.Namespace), client.MatchingFields{".metadata.name": autoscalingListener.Name}) | 					err := k8sClient.List(ctx, listenerList, client.InNamespace(autoscalingListener.Namespace), client.MatchingFields{".metadata.name": autoscalingListener.Name}) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return err | 						return err | ||||||
|  | @ -415,9 +415,9 @@ var _ = Describe("Test AutoScalingListener customization", func() { | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet | 	var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 	var autoscalingListener *actionsv1alpha1.AutoscalingListener | 	var autoscalingListener *v1alpha1.AutoscalingListener | ||||||
| 
 | 
 | ||||||
| 	var runAsUser int64 = 1001 | 	var runAsUser int64 = 1001 | ||||||
| 
 | 
 | ||||||
|  | @ -458,12 +458,12 @@ var _ = Describe("Test AutoScalingListener customization", func() { | ||||||
| 
 | 
 | ||||||
| 		min := 1 | 		min := 1 | ||||||
| 		max := 10 | 		max := 10 | ||||||
| 		autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{ | 		autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{ | 			Spec: v1alpha1.AutoscalingRunnerSetSpec{ | ||||||
| 				GitHubConfigUrl:    "https://github.com/owner/repo", | 				GitHubConfigUrl:    "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret: configSecret.Name, | 				GitHubConfigSecret: configSecret.Name, | ||||||
| 				MaxRunners:         &max, | 				MaxRunners:         &max, | ||||||
|  | @ -484,12 +484,12 @@ var _ = Describe("Test AutoScalingListener customization", func() { | ||||||
| 		err = k8sClient.Create(ctx, autoscalingRunnerSet) | 		err = k8sClient.Create(ctx, autoscalingRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | ||||||
| 
 | 
 | ||||||
| 		autoscalingListener = &actionsv1alpha1.AutoscalingListener{ | 		autoscalingListener = &v1alpha1.AutoscalingListener{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asltest", | 				Name:      "test-asltest", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingListenerSpec{ | 			Spec: v1alpha1.AutoscalingListenerSpec{ | ||||||
| 				GitHubConfigUrl:               "https://github.com/owner/repo", | 				GitHubConfigUrl:               "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret:            configSecret.Name, | 				GitHubConfigSecret:            configSecret.Name, | ||||||
| 				RunnerScaleSetId:              1, | 				RunnerScaleSetId:              1, | ||||||
|  | @ -512,7 +512,7 @@ var _ = Describe("Test AutoScalingListener customization", func() { | ||||||
| 	Context("When creating a new AutoScalingListener", func() { | 	Context("When creating a new AutoScalingListener", func() { | ||||||
| 		It("It should create customized pod with applied configuration", func() { | 		It("It should create customized pod with applied configuration", func() { | ||||||
| 			// Check if finalizer is added
 | 			// Check if finalizer is added
 | ||||||
| 			created := new(actionsv1alpha1.AutoscalingListener) | 			created := new(v1alpha1.AutoscalingListener) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (string, error) { | 				func() (string, error) { | ||||||
| 					err := k8sClient.Get(ctx, client.ObjectKey{Name: autoscalingListener.Name, Namespace: autoscalingListener.Namespace}, created) | 					err := k8sClient.Get(ctx, client.ObjectKey{Name: autoscalingListener.Name, Namespace: autoscalingListener.Namespace}, created) | ||||||
|  | @ -570,19 +570,19 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() { | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet | 	var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 	var autoscalingListener *actionsv1alpha1.AutoscalingListener | 	var autoscalingListener *v1alpha1.AutoscalingListener | ||||||
| 
 | 
 | ||||||
| 	createRunnerSetAndListener := func(proxy *actionsv1alpha1.ProxyConfig) { | 	createRunnerSetAndListener := func(proxy *v1alpha1.ProxyConfig) { | ||||||
| 		min := 1 | 		min := 1 | ||||||
| 		max := 10 | 		max := 10 | ||||||
| 		autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{ | 		autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{ | 			Spec: v1alpha1.AutoscalingRunnerSetSpec{ | ||||||
| 				GitHubConfigUrl:    "https://github.com/owner/repo", | 				GitHubConfigUrl:    "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret: configSecret.Name, | 				GitHubConfigSecret: configSecret.Name, | ||||||
| 				MaxRunners:         &max, | 				MaxRunners:         &max, | ||||||
|  | @ -604,12 +604,12 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() { | ||||||
| 		err := k8sClient.Create(ctx, autoscalingRunnerSet) | 		err := k8sClient.Create(ctx, autoscalingRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | ||||||
| 
 | 
 | ||||||
| 		autoscalingListener = &actionsv1alpha1.AutoscalingListener{ | 		autoscalingListener = &v1alpha1.AutoscalingListener{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asl", | 				Name:      "test-asl", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingListenerSpec{ | 			Spec: v1alpha1.AutoscalingListenerSpec{ | ||||||
| 				GitHubConfigUrl:               "https://github.com/owner/repo", | 				GitHubConfigUrl:               "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret:            configSecret.Name, | 				GitHubConfigSecret:            configSecret.Name, | ||||||
| 				RunnerScaleSetId:              1, | 				RunnerScaleSetId:              1, | ||||||
|  | @ -658,12 +658,12 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() { | ||||||
| 		err := k8sClient.Create(ctx, proxyCredentials) | 		err := k8sClient.Create(ctx, proxyCredentials) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create proxy credentials secret") | 		Expect(err).NotTo(HaveOccurred(), "failed to create proxy credentials secret") | ||||||
| 
 | 
 | ||||||
| 		proxy := &actionsv1alpha1.ProxyConfig{ | 		proxy := &v1alpha1.ProxyConfig{ | ||||||
| 			HTTP: &actionsv1alpha1.ProxyServerConfig{ | 			HTTP: &v1alpha1.ProxyServerConfig{ | ||||||
| 				Url:                 "http://localhost:8080", | 				Url:                 "http://localhost:8080", | ||||||
| 				CredentialSecretRef: "proxy-credentials", | 				CredentialSecretRef: "proxy-credentials", | ||||||
| 			}, | 			}, | ||||||
| 			HTTPS: &actionsv1alpha1.ProxyServerConfig{ | 			HTTPS: &v1alpha1.ProxyServerConfig{ | ||||||
| 				Url:                 "https://localhost:8443", | 				Url:                 "https://localhost:8443", | ||||||
| 				CredentialSecretRef: "proxy-credentials", | 				CredentialSecretRef: "proxy-credentials", | ||||||
| 			}, | 			}, | ||||||
|  | @ -766,19 +766,19 @@ var _ = Describe("Test AutoScalingListener controller with template modification | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet | 	var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 	var autoscalingListener *actionsv1alpha1.AutoscalingListener | 	var autoscalingListener *v1alpha1.AutoscalingListener | ||||||
| 
 | 
 | ||||||
| 	createRunnerSetAndListener := func(listenerTemplate *corev1.PodTemplateSpec) { | 	createRunnerSetAndListener := func(listenerTemplate *corev1.PodTemplateSpec) { | ||||||
| 		min := 1 | 		min := 1 | ||||||
| 		max := 10 | 		max := 10 | ||||||
| 		autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{ | 		autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{ | 			Spec: v1alpha1.AutoscalingRunnerSetSpec{ | ||||||
| 				GitHubConfigUrl:    "https://github.com/owner/repo", | 				GitHubConfigUrl:    "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret: configSecret.Name, | 				GitHubConfigSecret: configSecret.Name, | ||||||
| 				MaxRunners:         &max, | 				MaxRunners:         &max, | ||||||
|  | @ -800,12 +800,12 @@ var _ = Describe("Test AutoScalingListener controller with template modification | ||||||
| 		err := k8sClient.Create(ctx, autoscalingRunnerSet) | 		err := k8sClient.Create(ctx, autoscalingRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | ||||||
| 
 | 
 | ||||||
| 		autoscalingListener = &actionsv1alpha1.AutoscalingListener{ | 		autoscalingListener = &v1alpha1.AutoscalingListener{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asl", | 				Name:      "test-asl", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingListenerSpec{ | 			Spec: v1alpha1.AutoscalingListenerSpec{ | ||||||
| 				GitHubConfigUrl:               "https://github.com/owner/repo", | 				GitHubConfigUrl:               "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret:            configSecret.Name, | 				GitHubConfigSecret:            configSecret.Name, | ||||||
| 				RunnerScaleSetId:              1, | 				RunnerScaleSetId:              1, | ||||||
|  | @ -915,9 +915,9 @@ var _ = Describe("Test GitHub Server TLS configuration", func() { | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet | 	var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 	var autoscalingListener *actionsv1alpha1.AutoscalingListener | 	var autoscalingListener *v1alpha1.AutoscalingListener | ||||||
| 	var rootCAConfigMap *corev1.ConfigMap | 	var rootCAConfigMap *corev1.ConfigMap | ||||||
| 
 | 
 | ||||||
| 	BeforeEach(func() { | 	BeforeEach(func() { | ||||||
|  | @ -955,16 +955,16 @@ var _ = Describe("Test GitHub Server TLS configuration", func() { | ||||||
| 
 | 
 | ||||||
| 		min := 1 | 		min := 1 | ||||||
| 		max := 10 | 		max := 10 | ||||||
| 		autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{ | 		autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{ | 			Spec: v1alpha1.AutoscalingRunnerSetSpec{ | ||||||
| 				GitHubConfigUrl:    "https://github.com/owner/repo", | 				GitHubConfigUrl:    "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret: configSecret.Name, | 				GitHubConfigSecret: configSecret.Name, | ||||||
| 				GitHubServerTLS: &actionsv1alpha1.GitHubServerTLSConfig{ | 				GitHubServerTLS: &v1alpha1.GitHubServerTLSConfig{ | ||||||
| 					CertificateFrom: &actionsv1alpha1.TLSCertificateSource{ | 					CertificateFrom: &v1alpha1.TLSCertificateSource{ | ||||||
| 						ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ | 						ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ | ||||||
| 							LocalObjectReference: corev1.LocalObjectReference{ | 							LocalObjectReference: corev1.LocalObjectReference{ | ||||||
| 								Name: rootCAConfigMap.Name, | 								Name: rootCAConfigMap.Name, | ||||||
|  | @ -991,16 +991,16 @@ var _ = Describe("Test GitHub Server TLS configuration", func() { | ||||||
| 		err = k8sClient.Create(ctx, autoscalingRunnerSet) | 		err = k8sClient.Create(ctx, autoscalingRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet") | ||||||
| 
 | 
 | ||||||
| 		autoscalingListener = &actionsv1alpha1.AutoscalingListener{ | 		autoscalingListener = &v1alpha1.AutoscalingListener{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asl", | 				Name:      "test-asl", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.AutoscalingListenerSpec{ | 			Spec: v1alpha1.AutoscalingListenerSpec{ | ||||||
| 				GitHubConfigUrl:    "https://github.com/owner/repo", | 				GitHubConfigUrl:    "https://github.com/owner/repo", | ||||||
| 				GitHubConfigSecret: configSecret.Name, | 				GitHubConfigSecret: configSecret.Name, | ||||||
| 				GitHubServerTLS: &actionsv1alpha1.GitHubServerTLSConfig{ | 				GitHubServerTLS: &v1alpha1.GitHubServerTLSConfig{ | ||||||
| 					CertificateFrom: &actionsv1alpha1.TLSCertificateSource{ | 					CertificateFrom: &v1alpha1.TLSCertificateSource{ | ||||||
| 						ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ | 						ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ | ||||||
| 							LocalObjectReference: corev1.LocalObjectReference{ | 							LocalObjectReference: corev1.LocalObjectReference{ | ||||||
| 								Name: rootCAConfigMap.Name, | 								Name: rootCAConfigMap.Name, | ||||||
|  |  | ||||||
|  | @ -23,8 +23,7 @@ import ( | ||||||
| 	. "github.com/onsi/gomega" | 	. "github.com/onsi/gomega" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 
 | 
 | ||||||
| 	actionsv1alpha1 "github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1" | 	"github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1" | ||||||
| 	v1alpha1 "github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1" |  | ||||||
| 	"github.com/actions/actions-runner-controller/github/actions" | 	"github.com/actions/actions-runner-controller/github/actions" | ||||||
| 	"github.com/actions/actions-runner-controller/github/actions/fake" | 	"github.com/actions/actions-runner-controller/github/actions/fake" | ||||||
| 	"github.com/actions/actions-runner-controller/github/actions/testserver" | 	"github.com/actions/actions-runner-controller/github/actions/testserver" | ||||||
|  | @ -40,7 +39,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var ephemeralRunnerSet *actionsv1alpha1.EphemeralRunnerSet | 	var ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 
 | 
 | ||||||
| 	BeforeEach(func() { | 	BeforeEach(func() { | ||||||
|  | @ -57,13 +56,13 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		err := controller.SetupWithManager(mgr) | 		err := controller.SetupWithManager(mgr) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to setup controller") | 		Expect(err).NotTo(HaveOccurred(), "failed to setup controller") | ||||||
| 
 | 
 | ||||||
| 		ephemeralRunnerSet = &actionsv1alpha1.EphemeralRunnerSet{ | 		ephemeralRunnerSet = &v1alpha1.EphemeralRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.EphemeralRunnerSetSpec{ | 			Spec: v1alpha1.EphemeralRunnerSetSpec{ | ||||||
| 				EphemeralRunnerSpec: actionsv1alpha1.EphemeralRunnerSpec{ | 				EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ | ||||||
| 					GitHubConfigUrl:    "https://github.com/owner/repo", | 					GitHubConfigUrl:    "https://github.com/owner/repo", | ||||||
| 					GitHubConfigSecret: configSecret.Name, | 					GitHubConfigSecret: configSecret.Name, | ||||||
| 					RunnerScaleSetId:   100, | 					RunnerScaleSetId:   100, | ||||||
|  | @ -90,7 +89,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 	Context("When creating a new EphemeralRunnerSet", func() { | 	Context("When creating a new EphemeralRunnerSet", func() { | ||||||
| 		It("It should create/add all required resources for a new EphemeralRunnerSet (finalizer)", func() { | 		It("It should create/add all required resources for a new EphemeralRunnerSet (finalizer)", func() { | ||||||
| 			// Check if finalizer is added
 | 			// Check if finalizer is added
 | ||||||
| 			created := new(actionsv1alpha1.EphemeralRunnerSet) | 			created := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (string, error) { | 				func() (string, error) { | ||||||
| 					err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, created) | 					err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, created) | ||||||
|  | @ -108,7 +107,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Check if the number of ephemeral runners are stay 0
 | 			// Check if the number of ephemeral runners are stay 0
 | ||||||
| 			Consistently( | 			Consistently( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 					runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return -1, err | 						return -1, err | ||||||
|  | @ -122,7 +121,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Check if the status stay 0
 | 			// Check if the status stay 0
 | ||||||
| 			Consistently( | 			Consistently( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					runnerSet := new(actionsv1alpha1.EphemeralRunnerSet) | 					runnerSet := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 					err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, runnerSet) | 					err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, runnerSet) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return -1, err | 						return -1, err | ||||||
|  | @ -142,7 +141,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Check if the number of ephemeral runners are created
 | 			// Check if the number of ephemeral runners are created
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 					runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return -1, err | 						return -1, err | ||||||
|  | @ -176,7 +175,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Check if the status is updated
 | 			// Check if the status is updated
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					runnerSet := new(actionsv1alpha1.EphemeralRunnerSet) | 					runnerSet := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 					err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, runnerSet) | 					err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, runnerSet) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return -1, err | 						return -1, err | ||||||
|  | @ -191,7 +190,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 
 | 
 | ||||||
| 	Context("When deleting a new EphemeralRunnerSet", func() { | 	Context("When deleting a new EphemeralRunnerSet", func() { | ||||||
| 		It("It should cleanup all resources for a deleting EphemeralRunnerSet before removing it", func() { | 		It("It should cleanup all resources for a deleting EphemeralRunnerSet before removing it", func() { | ||||||
| 			created := new(actionsv1alpha1.EphemeralRunnerSet) | 			created := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, created) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, created) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -204,7 +203,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Wait for the EphemeralRunnerSet to be scaled up
 | 			// Wait for the EphemeralRunnerSet to be scaled up
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 					runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return -1, err | 						return -1, err | ||||||
|  | @ -242,7 +241,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Check if all ephemeral runners are deleted
 | 			// Check if all ephemeral runners are deleted
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 					runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return -1, err | 						return -1, err | ||||||
|  | @ -256,7 +255,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Check if the EphemeralRunnerSet is deleted
 | 			// Check if the EphemeralRunnerSet is deleted
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
| 					deleted := new(actionsv1alpha1.EphemeralRunnerSet) | 					deleted := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 					err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, deleted) | 					err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, deleted) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						if kerrors.IsNotFound(err) { | 						if kerrors.IsNotFound(err) { | ||||||
|  | @ -275,7 +274,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 
 | 
 | ||||||
| 	Context("When a new EphemeralRunnerSet scale up and down", func() { | 	Context("When a new EphemeralRunnerSet scale up and down", func() { | ||||||
| 		It("Should scale up with patch ID 0", func() { | 		It("Should scale up with patch ID 0", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -286,7 +285,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -302,7 +301,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should scale up when patch ID changes", func() { | 		It("Should scale up when patch ID changes", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -313,7 +312,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -327,7 +326,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 				ephemeralRunnerSetTestInterval, | 				ephemeralRunnerSetTestInterval, | ||||||
| 			).Should(BeEquivalentTo(1), "1 EphemeralRunner should be created") | 			).Should(BeEquivalentTo(1), "1 EphemeralRunner should be created") | ||||||
| 
 | 
 | ||||||
| 			ers = new(actionsv1alpha1.EphemeralRunnerSet) | 			ers = new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -338,7 +337,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -354,7 +353,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should clean up finished ephemeral runner when scaling down", func() { | 		It("Should clean up finished ephemeral runner when scaling down", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -365,7 +364,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -390,7 +389,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | ||||||
| 
 | 
 | ||||||
| 			// Keep the ephemeral runner until the next patch
 | 			// Keep the ephemeral runner until the next patch
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -405,7 +404,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			).Should(BeEquivalentTo(2), "1 EphemeralRunner should be up") | 			).Should(BeEquivalentTo(2), "1 EphemeralRunner should be up") | ||||||
| 
 | 
 | ||||||
| 			// The listener was slower to patch the completed, but we should still have 1 running
 | 			// The listener was slower to patch the completed, but we should still have 1 running
 | ||||||
| 			ers = new(actionsv1alpha1.EphemeralRunnerSet) | 			ers = new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -416,7 +415,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -432,7 +431,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should keep finished ephemeral runners until patch id changes", func() { | 		It("Should keep finished ephemeral runners until patch id changes", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -443,7 +442,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -468,7 +467,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | ||||||
| 
 | 
 | ||||||
| 			// confirm they are not deleted
 | 			// confirm they are not deleted
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Consistently( | 			Consistently( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -484,7 +483,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should handle double scale up", func() { | 		It("Should handle double scale up", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -495,7 +494,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -520,7 +519,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[1])) | 			err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[1])) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | ||||||
| 
 | 
 | ||||||
| 			ers = new(actionsv1alpha1.EphemeralRunnerSet) | 			ers = new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -531,7 +530,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			// We should have 3 runners, and have no Succeeded ones
 | 			// We should have 3 runners, and have no Succeeded ones
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
|  | @ -558,7 +557,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should handle scale down without removing pending runners", func() { | 		It("Should handle scale down without removing pending runners", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -569,7 +568,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -594,7 +593,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | ||||||
| 
 | 
 | ||||||
| 			// Wait for these statuses to actually be updated
 | 			// Wait for these statuses to actually be updated
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -623,7 +622,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			).Should(BeNil(), "1 EphemeralRunner should be in Pending and 1 in Succeeded phase") | 			).Should(BeNil(), "1 EphemeralRunner should be in Pending and 1 in Succeeded phase") | ||||||
| 
 | 
 | ||||||
| 			// Scale down to 0, while 1 is still pending. This simulates the difference between the desired and actual state
 | 			// Scale down to 0, while 1 is still pending. This simulates the difference between the desired and actual state
 | ||||||
| 			ers = new(actionsv1alpha1.EphemeralRunnerSet) | 			ers = new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -634,7 +633,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			// We should have 1 runner up and pending
 | 			// We should have 1 runner up and pending
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
|  | @ -678,7 +677,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should kill pending and running runners if they are up for some reason and the batch contains no jobs", func() { | 		It("Should kill pending and running runners if they are up for some reason and the batch contains no jobs", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -689,7 +688,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -715,7 +714,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | ||||||
| 
 | 
 | ||||||
| 			// Wait for these statuses to actually be updated
 | 			// Wait for these statuses to actually be updated
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -748,7 +747,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 
 | 
 | ||||||
| 			// Scale down to 0 with patch ID 0. This forces the scale down to self correct on empty batch
 | 			// Scale down to 0 with patch ID 0. This forces the scale down to self correct on empty batch
 | ||||||
| 
 | 
 | ||||||
| 			ers = new(actionsv1alpha1.EphemeralRunnerSet) | 			ers = new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -759,7 +758,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Consistently( | 			Consistently( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -786,7 +785,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") | ||||||
| 
 | 
 | ||||||
| 			// Now, eventually, they should be deleted
 | 			// Now, eventually, they should be deleted
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -803,7 +802,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should replace finished ephemeral runners with new ones", func() { | 		It("Should replace finished ephemeral runners with new ones", func() { | ||||||
| 			ers := new(actionsv1alpha1.EphemeralRunnerSet) | 			ers := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -814,7 +813,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -841,7 +840,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 
 | 
 | ||||||
| 			// Wait for these statuses to actually be updated
 | 			// Wait for these statuses to actually be updated
 | ||||||
| 
 | 
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -874,7 +873,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			// Now, let's simulate replacement. The desired count is still 2.
 | 			// Now, let's simulate replacement. The desired count is still 2.
 | ||||||
| 			// This simulates that we got 1 job assigned, and 1 job completed.
 | 			// This simulates that we got 1 job assigned, and 1 job completed.
 | ||||||
| 
 | 
 | ||||||
| 			ers = new(actionsv1alpha1.EphemeralRunnerSet) | 			ers = new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | 			err = k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, ers) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -885,7 +884,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | 			err = k8sClient.Patch(ctx, updated, client.MergeFrom(ers)) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 			runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -911,7 +910,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		It("Should update status on Ephemeral Runner state changes", func() { | 		It("Should update status on Ephemeral Runner state changes", func() { | ||||||
| 			created := new(actionsv1alpha1.EphemeralRunnerSet) | 			created := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() error { | 				func() error { | ||||||
| 					return k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, created) | 					return k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunnerSet.Name, Namespace: ephemeralRunnerSet.Namespace}, created) | ||||||
|  | @ -926,7 +925,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 			err := k8sClient.Update(ctx, updated) | 			err := k8sClient.Update(ctx, updated) | ||||||
| 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet replica count") | 			Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunnerSet replica count") | ||||||
| 
 | 
 | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (bool, error) { | 				func() (bool, error) { | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
|  | @ -1036,7 +1035,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { | ||||||
| 
 | 
 | ||||||
| 			Eventually( | 			Eventually( | ||||||
| 				func() (int, error) { | 				func() (int, error) { | ||||||
| 					runnerList = new(actionsv1alpha1.EphemeralRunnerList) | 					runnerList = new(v1alpha1.EphemeralRunnerList) | ||||||
| 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 					err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return -1, err | 						return -1, err | ||||||
|  | @ -1091,7 +1090,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var ephemeralRunnerSet *actionsv1alpha1.EphemeralRunnerSet | 	var ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 
 | 
 | ||||||
| 	BeforeEach(func() { | 	BeforeEach(func() { | ||||||
|  | @ -1126,14 +1125,14 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( | ||||||
| 		err := k8sClient.Create(ctx, secretCredentials) | 		err := k8sClient.Create(ctx, secretCredentials) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create secret credentials") | 		Expect(err).NotTo(HaveOccurred(), "failed to create secret credentials") | ||||||
| 
 | 
 | ||||||
| 		ephemeralRunnerSet = &actionsv1alpha1.EphemeralRunnerSet{ | 		ephemeralRunnerSet = &v1alpha1.EphemeralRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.EphemeralRunnerSetSpec{ | 			Spec: v1alpha1.EphemeralRunnerSetSpec{ | ||||||
| 				Replicas: 1, | 				Replicas: 1, | ||||||
| 				EphemeralRunnerSpec: actionsv1alpha1.EphemeralRunnerSpec{ | 				EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ | ||||||
| 					GitHubConfigUrl:    "http://example.com/owner/repo", | 					GitHubConfigUrl:    "http://example.com/owner/repo", | ||||||
| 					GitHubConfigSecret: configSecret.Name, | 					GitHubConfigSecret: configSecret.Name, | ||||||
| 					RunnerScaleSetId:   100, | 					RunnerScaleSetId:   100, | ||||||
|  | @ -1193,7 +1192,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( | ||||||
| 		).Should(Succeed(), "compiled / flattened proxy secret should exist") | 		).Should(Succeed(), "compiled / flattened proxy secret should exist") | ||||||
| 
 | 
 | ||||||
| 		Eventually(func(g Gomega) { | 		Eventually(func(g Gomega) { | ||||||
| 			runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 			runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 			err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 			err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 			g.Expect(err).NotTo(HaveOccurred(), "failed to list EphemeralRunners") | 			g.Expect(err).NotTo(HaveOccurred(), "failed to list EphemeralRunners") | ||||||
| 
 | 
 | ||||||
|  | @ -1211,7 +1210,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( | ||||||
| 		// Set pods to PodSucceeded to simulate an actual EphemeralRunner stopping
 | 		// Set pods to PodSucceeded to simulate an actual EphemeralRunner stopping
 | ||||||
| 		Eventually( | 		Eventually( | ||||||
| 			func(g Gomega) (int, error) { | 			func(g Gomega) (int, error) { | ||||||
| 				runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 				runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 				err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 				err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 				if err != nil { | 				if err != nil { | ||||||
| 					return -1, err | 					return -1, err | ||||||
|  | @ -1293,14 +1292,14 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( | ||||||
| 			proxy.Close() | 			proxy.Close() | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 		ephemeralRunnerSet = &actionsv1alpha1.EphemeralRunnerSet{ | 		ephemeralRunnerSet = &v1alpha1.EphemeralRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.EphemeralRunnerSetSpec{ | 			Spec: v1alpha1.EphemeralRunnerSetSpec{ | ||||||
| 				Replicas: 1, | 				Replicas: 1, | ||||||
| 				EphemeralRunnerSpec: actionsv1alpha1.EphemeralRunnerSpec{ | 				EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ | ||||||
| 					GitHubConfigUrl:    "http://example.com/owner/repo", | 					GitHubConfigUrl:    "http://example.com/owner/repo", | ||||||
| 					GitHubConfigSecret: configSecret.Name, | 					GitHubConfigSecret: configSecret.Name, | ||||||
| 					RunnerScaleSetId:   100, | 					RunnerScaleSetId:   100, | ||||||
|  | @ -1327,7 +1326,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( | ||||||
| 		err = k8sClient.Create(ctx, ephemeralRunnerSet) | 		err = k8sClient.Create(ctx, ephemeralRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create EphemeralRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to create EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 		runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 		runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 		Eventually(func() (int, error) { | 		Eventually(func() (int, error) { | ||||||
| 			err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 			err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
|  | @ -1346,7 +1345,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( | ||||||
| 		err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0])) | 		err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0])) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status") | 		Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status") | ||||||
| 
 | 
 | ||||||
| 		runnerSet := new(actionsv1alpha1.EphemeralRunnerSet) | 		runnerSet := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 		err = k8sClient.Get(ctx, client.ObjectKey{Namespace: ephemeralRunnerSet.Namespace, Name: ephemeralRunnerSet.Name}, runnerSet) | 		err = k8sClient.Get(ctx, client.ObjectKey{Namespace: ephemeralRunnerSet.Namespace, Name: ephemeralRunnerSet.Name}, runnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  | @ -1369,7 +1368,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func( | ||||||
| 	var ctx context.Context | 	var ctx context.Context | ||||||
| 	var mgr ctrl.Manager | 	var mgr ctrl.Manager | ||||||
| 	var autoscalingNS *corev1.Namespace | 	var autoscalingNS *corev1.Namespace | ||||||
| 	var ephemeralRunnerSet *actionsv1alpha1.EphemeralRunnerSet | 	var ephemeralRunnerSet *v1alpha1.EphemeralRunnerSet | ||||||
| 	var configSecret *corev1.Secret | 	var configSecret *corev1.Secret | ||||||
| 	var rootCAConfigMap *corev1.ConfigMap | 	var rootCAConfigMap *corev1.ConfigMap | ||||||
| 
 | 
 | ||||||
|  | @ -1431,17 +1430,17 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func( | ||||||
| 		server.TLS = &tls.Config{Certificates: []tls.Certificate{cert}} | 		server.TLS = &tls.Config{Certificates: []tls.Certificate{cert}} | ||||||
| 		server.StartTLS() | 		server.StartTLS() | ||||||
| 
 | 
 | ||||||
| 		ephemeralRunnerSet = &actionsv1alpha1.EphemeralRunnerSet{ | 		ephemeralRunnerSet = &v1alpha1.EphemeralRunnerSet{ | ||||||
| 			ObjectMeta: metav1.ObjectMeta{ | 			ObjectMeta: metav1.ObjectMeta{ | ||||||
| 				Name:      "test-asrs", | 				Name:      "test-asrs", | ||||||
| 				Namespace: autoscalingNS.Name, | 				Namespace: autoscalingNS.Name, | ||||||
| 			}, | 			}, | ||||||
| 			Spec: actionsv1alpha1.EphemeralRunnerSetSpec{ | 			Spec: v1alpha1.EphemeralRunnerSetSpec{ | ||||||
| 				Replicas: 1, | 				Replicas: 1, | ||||||
| 				EphemeralRunnerSpec: actionsv1alpha1.EphemeralRunnerSpec{ | 				EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ | ||||||
| 					GitHubConfigUrl:    server.ConfigURLForOrg("my-org"), | 					GitHubConfigUrl:    server.ConfigURLForOrg("my-org"), | ||||||
| 					GitHubConfigSecret: configSecret.Name, | 					GitHubConfigSecret: configSecret.Name, | ||||||
| 					GitHubServerTLS: &actionsv1alpha1.GitHubServerTLSConfig{ | 					GitHubServerTLS: &v1alpha1.GitHubServerTLSConfig{ | ||||||
| 						CertificateFrom: &v1alpha1.TLSCertificateSource{ | 						CertificateFrom: &v1alpha1.TLSCertificateSource{ | ||||||
| 							ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ | 							ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ | ||||||
| 								LocalObjectReference: corev1.LocalObjectReference{ | 								LocalObjectReference: corev1.LocalObjectReference{ | ||||||
|  | @ -1469,7 +1468,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func( | ||||||
| 		err = k8sClient.Create(ctx, ephemeralRunnerSet) | 		err = k8sClient.Create(ctx, ephemeralRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to create EphemeralRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to create EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
| 		runnerList := new(actionsv1alpha1.EphemeralRunnerList) | 		runnerList := new(v1alpha1.EphemeralRunnerList) | ||||||
| 		Eventually(func() (int, error) { | 		Eventually(func() (int, error) { | ||||||
| 			err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | 			err := k8sClient.List(ctx, runnerList, client.InNamespace(ephemeralRunnerSet.Namespace)) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
|  | @ -1491,7 +1490,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func( | ||||||
| 		err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0])) | 		err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0])) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status") | 		Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status") | ||||||
| 
 | 
 | ||||||
| 		currentRunnerSet := new(actionsv1alpha1.EphemeralRunnerSet) | 		currentRunnerSet := new(v1alpha1.EphemeralRunnerSet) | ||||||
| 		err = k8sClient.Get(ctx, client.ObjectKey{Namespace: ephemeralRunnerSet.Namespace, Name: ephemeralRunnerSet.Name}, currentRunnerSet) | 		err = k8sClient.Get(ctx, client.ObjectKey{Namespace: ephemeralRunnerSet.Namespace, Name: ephemeralRunnerSet.Name}, currentRunnerSet) | ||||||
| 		Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | 		Expect(err).NotTo(HaveOccurred(), "failed to get EphemeralRunnerSet") | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue