Skip to content

Commit 9b51f25

Browse files
authored
Rename imports in tests to remove double import and to improve readability (#3455)
1 parent ea13873 commit 9b51f25

File tree

2 files changed

+111
-112
lines changed

2 files changed

+111
-112
lines changed

controllers/actions.github.com/autoscalinglistener_controller_test.go

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/apimachinery/pkg/types"
2323

24-
actionsv1alpha1 "github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1"
24+
"github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1"
2525
)
2626

2727
const (
@@ -34,9 +34,9 @@ var _ = Describe("Test AutoScalingListener controller", func() {
3434
var ctx context.Context
3535
var mgr ctrl.Manager
3636
var autoscalingNS *corev1.Namespace
37-
var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet
37+
var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet
3838
var configSecret *corev1.Secret
39-
var autoscalingListener *actionsv1alpha1.AutoscalingListener
39+
var autoscalingListener *v1alpha1.AutoscalingListener
4040

4141
BeforeEach(func() {
4242
ctx = context.Background()
@@ -53,12 +53,12 @@ var _ = Describe("Test AutoScalingListener controller", func() {
5353

5454
min := 1
5555
max := 10
56-
autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{
56+
autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{
5757
ObjectMeta: metav1.ObjectMeta{
5858
Name: "test-asrs",
5959
Namespace: autoscalingNS.Name,
6060
},
61-
Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{
61+
Spec: v1alpha1.AutoscalingRunnerSetSpec{
6262
GitHubConfigUrl: "https://github.com/owner/repo",
6363
GitHubConfigSecret: configSecret.Name,
6464
MaxRunners: &max,
@@ -79,12 +79,12 @@ var _ = Describe("Test AutoScalingListener controller", func() {
7979
err = k8sClient.Create(ctx, autoscalingRunnerSet)
8080
Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet")
8181

82-
autoscalingListener = &actionsv1alpha1.AutoscalingListener{
82+
autoscalingListener = &v1alpha1.AutoscalingListener{
8383
ObjectMeta: metav1.ObjectMeta{
8484
Name: "test-asl",
8585
Namespace: autoscalingNS.Name,
8686
},
87-
Spec: actionsv1alpha1.AutoscalingListenerSpec{
87+
Spec: v1alpha1.AutoscalingListenerSpec{
8888
GitHubConfigUrl: "https://github.com/owner/repo",
8989
GitHubConfigSecret: configSecret.Name,
9090
RunnerScaleSetId: 1,
@@ -119,7 +119,7 @@ var _ = Describe("Test AutoScalingListener controller", func() {
119119
).Should(Succeed(), "Config secret should be created")
120120

121121
// Check if finalizer is added
122-
created := new(actionsv1alpha1.AutoscalingListener)
122+
created := new(v1alpha1.AutoscalingListener)
123123
Eventually(
124124
func() (string, error) {
125125
err := k8sClient.Get(ctx, client.ObjectKey{Name: autoscalingListener.Name, Namespace: autoscalingListener.Namespace}, created)
@@ -298,7 +298,7 @@ var _ = Describe("Test AutoScalingListener controller", func() {
298298
// The AutoScalingListener should be deleted
299299
Eventually(
300300
func() error {
301-
listenerList := new(actionsv1alpha1.AutoscalingListenerList)
301+
listenerList := new(v1alpha1.AutoscalingListenerList)
302302
err := k8sClient.List(ctx, listenerList, client.InNamespace(autoscalingListener.Namespace), client.MatchingFields{".metadata.name": autoscalingListener.Name})
303303
if err != nil {
304304
return err
@@ -415,9 +415,9 @@ var _ = Describe("Test AutoScalingListener customization", func() {
415415
var ctx context.Context
416416
var mgr ctrl.Manager
417417
var autoscalingNS *corev1.Namespace
418-
var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet
418+
var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet
419419
var configSecret *corev1.Secret
420-
var autoscalingListener *actionsv1alpha1.AutoscalingListener
420+
var autoscalingListener *v1alpha1.AutoscalingListener
421421

422422
var runAsUser int64 = 1001
423423

@@ -458,12 +458,12 @@ var _ = Describe("Test AutoScalingListener customization", func() {
458458

459459
min := 1
460460
max := 10
461-
autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{
461+
autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{
462462
ObjectMeta: metav1.ObjectMeta{
463463
Name: "test-asrs",
464464
Namespace: autoscalingNS.Name,
465465
},
466-
Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{
466+
Spec: v1alpha1.AutoscalingRunnerSetSpec{
467467
GitHubConfigUrl: "https://github.com/owner/repo",
468468
GitHubConfigSecret: configSecret.Name,
469469
MaxRunners: &max,
@@ -484,12 +484,12 @@ var _ = Describe("Test AutoScalingListener customization", func() {
484484
err = k8sClient.Create(ctx, autoscalingRunnerSet)
485485
Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet")
486486

487-
autoscalingListener = &actionsv1alpha1.AutoscalingListener{
487+
autoscalingListener = &v1alpha1.AutoscalingListener{
488488
ObjectMeta: metav1.ObjectMeta{
489489
Name: "test-asltest",
490490
Namespace: autoscalingNS.Name,
491491
},
492-
Spec: actionsv1alpha1.AutoscalingListenerSpec{
492+
Spec: v1alpha1.AutoscalingListenerSpec{
493493
GitHubConfigUrl: "https://github.com/owner/repo",
494494
GitHubConfigSecret: configSecret.Name,
495495
RunnerScaleSetId: 1,
@@ -512,7 +512,7 @@ var _ = Describe("Test AutoScalingListener customization", func() {
512512
Context("When creating a new AutoScalingListener", func() {
513513
It("It should create customized pod with applied configuration", func() {
514514
// Check if finalizer is added
515-
created := new(actionsv1alpha1.AutoscalingListener)
515+
created := new(v1alpha1.AutoscalingListener)
516516
Eventually(
517517
func() (string, error) {
518518
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() {
570570
var ctx context.Context
571571
var mgr ctrl.Manager
572572
var autoscalingNS *corev1.Namespace
573-
var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet
573+
var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet
574574
var configSecret *corev1.Secret
575-
var autoscalingListener *actionsv1alpha1.AutoscalingListener
575+
var autoscalingListener *v1alpha1.AutoscalingListener
576576

577-
createRunnerSetAndListener := func(proxy *actionsv1alpha1.ProxyConfig) {
577+
createRunnerSetAndListener := func(proxy *v1alpha1.ProxyConfig) {
578578
min := 1
579579
max := 10
580-
autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{
580+
autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{
581581
ObjectMeta: metav1.ObjectMeta{
582582
Name: "test-asrs",
583583
Namespace: autoscalingNS.Name,
584584
},
585-
Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{
585+
Spec: v1alpha1.AutoscalingRunnerSetSpec{
586586
GitHubConfigUrl: "https://github.com/owner/repo",
587587
GitHubConfigSecret: configSecret.Name,
588588
MaxRunners: &max,
@@ -604,12 +604,12 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
604604
err := k8sClient.Create(ctx, autoscalingRunnerSet)
605605
Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet")
606606

607-
autoscalingListener = &actionsv1alpha1.AutoscalingListener{
607+
autoscalingListener = &v1alpha1.AutoscalingListener{
608608
ObjectMeta: metav1.ObjectMeta{
609609
Name: "test-asl",
610610
Namespace: autoscalingNS.Name,
611611
},
612-
Spec: actionsv1alpha1.AutoscalingListenerSpec{
612+
Spec: v1alpha1.AutoscalingListenerSpec{
613613
GitHubConfigUrl: "https://github.com/owner/repo",
614614
GitHubConfigSecret: configSecret.Name,
615615
RunnerScaleSetId: 1,
@@ -658,12 +658,12 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
658658
err := k8sClient.Create(ctx, proxyCredentials)
659659
Expect(err).NotTo(HaveOccurred(), "failed to create proxy credentials secret")
660660

661-
proxy := &actionsv1alpha1.ProxyConfig{
662-
HTTP: &actionsv1alpha1.ProxyServerConfig{
661+
proxy := &v1alpha1.ProxyConfig{
662+
HTTP: &v1alpha1.ProxyServerConfig{
663663
Url: "http://localhost:8080",
664664
CredentialSecretRef: "proxy-credentials",
665665
},
666-
HTTPS: &actionsv1alpha1.ProxyServerConfig{
666+
HTTPS: &v1alpha1.ProxyServerConfig{
667667
Url: "https://localhost:8443",
668668
CredentialSecretRef: "proxy-credentials",
669669
},
@@ -766,19 +766,19 @@ var _ = Describe("Test AutoScalingListener controller with template modification
766766
var ctx context.Context
767767
var mgr ctrl.Manager
768768
var autoscalingNS *corev1.Namespace
769-
var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet
769+
var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet
770770
var configSecret *corev1.Secret
771-
var autoscalingListener *actionsv1alpha1.AutoscalingListener
771+
var autoscalingListener *v1alpha1.AutoscalingListener
772772

773773
createRunnerSetAndListener := func(listenerTemplate *corev1.PodTemplateSpec) {
774774
min := 1
775775
max := 10
776-
autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{
776+
autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{
777777
ObjectMeta: metav1.ObjectMeta{
778778
Name: "test-asrs",
779779
Namespace: autoscalingNS.Name,
780780
},
781-
Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{
781+
Spec: v1alpha1.AutoscalingRunnerSetSpec{
782782
GitHubConfigUrl: "https://github.com/owner/repo",
783783
GitHubConfigSecret: configSecret.Name,
784784
MaxRunners: &max,
@@ -800,12 +800,12 @@ var _ = Describe("Test AutoScalingListener controller with template modification
800800
err := k8sClient.Create(ctx, autoscalingRunnerSet)
801801
Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet")
802802

803-
autoscalingListener = &actionsv1alpha1.AutoscalingListener{
803+
autoscalingListener = &v1alpha1.AutoscalingListener{
804804
ObjectMeta: metav1.ObjectMeta{
805805
Name: "test-asl",
806806
Namespace: autoscalingNS.Name,
807807
},
808-
Spec: actionsv1alpha1.AutoscalingListenerSpec{
808+
Spec: v1alpha1.AutoscalingListenerSpec{
809809
GitHubConfigUrl: "https://github.com/owner/repo",
810810
GitHubConfigSecret: configSecret.Name,
811811
RunnerScaleSetId: 1,
@@ -915,9 +915,9 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
915915
var ctx context.Context
916916
var mgr ctrl.Manager
917917
var autoscalingNS *corev1.Namespace
918-
var autoscalingRunnerSet *actionsv1alpha1.AutoscalingRunnerSet
918+
var autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet
919919
var configSecret *corev1.Secret
920-
var autoscalingListener *actionsv1alpha1.AutoscalingListener
920+
var autoscalingListener *v1alpha1.AutoscalingListener
921921
var rootCAConfigMap *corev1.ConfigMap
922922

923923
BeforeEach(func() {
@@ -955,16 +955,16 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
955955

956956
min := 1
957957
max := 10
958-
autoscalingRunnerSet = &actionsv1alpha1.AutoscalingRunnerSet{
958+
autoscalingRunnerSet = &v1alpha1.AutoscalingRunnerSet{
959959
ObjectMeta: metav1.ObjectMeta{
960960
Name: "test-asrs",
961961
Namespace: autoscalingNS.Name,
962962
},
963-
Spec: actionsv1alpha1.AutoscalingRunnerSetSpec{
963+
Spec: v1alpha1.AutoscalingRunnerSetSpec{
964964
GitHubConfigUrl: "https://github.com/owner/repo",
965965
GitHubConfigSecret: configSecret.Name,
966-
GitHubServerTLS: &actionsv1alpha1.GitHubServerTLSConfig{
967-
CertificateFrom: &actionsv1alpha1.TLSCertificateSource{
966+
GitHubServerTLS: &v1alpha1.GitHubServerTLSConfig{
967+
CertificateFrom: &v1alpha1.TLSCertificateSource{
968968
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
969969
LocalObjectReference: corev1.LocalObjectReference{
970970
Name: rootCAConfigMap.Name,
@@ -991,16 +991,16 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
991991
err = k8sClient.Create(ctx, autoscalingRunnerSet)
992992
Expect(err).NotTo(HaveOccurred(), "failed to create AutoScalingRunnerSet")
993993

994-
autoscalingListener = &actionsv1alpha1.AutoscalingListener{
994+
autoscalingListener = &v1alpha1.AutoscalingListener{
995995
ObjectMeta: metav1.ObjectMeta{
996996
Name: "test-asl",
997997
Namespace: autoscalingNS.Name,
998998
},
999-
Spec: actionsv1alpha1.AutoscalingListenerSpec{
999+
Spec: v1alpha1.AutoscalingListenerSpec{
10001000
GitHubConfigUrl: "https://github.com/owner/repo",
10011001
GitHubConfigSecret: configSecret.Name,
1002-
GitHubServerTLS: &actionsv1alpha1.GitHubServerTLSConfig{
1003-
CertificateFrom: &actionsv1alpha1.TLSCertificateSource{
1002+
GitHubServerTLS: &v1alpha1.GitHubServerTLSConfig{
1003+
CertificateFrom: &v1alpha1.TLSCertificateSource{
10041004
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
10051005
LocalObjectReference: corev1.LocalObjectReference{
10061006
Name: rootCAConfigMap.Name,

0 commit comments

Comments
 (0)