1
- package iosnapshot
1
+ package iosnapshot_test
2
2
3
3
import (
4
4
"context"
8
8
gomegatypes "github.com/onsi/gomega/types"
9
9
"github.com/solo-io/gloo/pkg/schemes"
10
10
gloov1 "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/kube/apis/gloo.solo.io/v1"
11
+ "github.com/solo-io/gloo/projects/gloo/pkg/servers/iosnapshot"
11
12
apiv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
12
13
13
14
wellknownkube "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/kube/wellknown"
@@ -52,16 +53,16 @@ var _ = Describe("History", func() {
52
53
ctx context.Context
53
54
54
55
clientBuilder * fake.ClientBuilder
55
- history History
56
+ history iosnapshot. History
56
57
57
- historyFactorParams HistoryFactoryParameters
58
+ historyFactorParams iosnapshot. HistoryFactoryParameters
58
59
)
59
60
60
61
BeforeEach (func () {
61
62
ctx = context .Background ()
62
63
clientBuilder = fake .NewClientBuilder ().WithScheme (schemes .DefaultScheme ())
63
64
64
- historyFactorParams = HistoryFactoryParameters {
65
+ historyFactorParams = iosnapshot. HistoryFactoryParameters {
65
66
Settings : & v1.Settings {
66
67
Metadata : & core.Metadata {
67
68
Name : "my-settings" ,
@@ -98,11 +99,11 @@ var _ = Describe("History", func() {
98
99
},
99
100
}
100
101
101
- history = NewHistory (
102
+ history = iosnapshot . NewHistory (
102
103
historyFactorParams .Cache ,
103
104
historyFactorParams .Settings ,
104
105
clientBuilder .WithObjects (clientObjects ... ).Build (),
105
- append (CompleteInputSnapshotGVKs , deploymentGvk ), // include the Deployment GVK
106
+ append (iosnapshot . CompleteInputSnapshotGVKs , deploymentGvk ), // include the Deployment GVK
106
107
)
107
108
})
108
109
@@ -136,15 +137,15 @@ var _ = Describe("History", func() {
136
137
},
137
138
}
138
139
139
- history = NewHistory (& xds.MockXdsCache {},
140
+ history = iosnapshot . NewHistory (& xds.MockXdsCache {},
140
141
& v1.Settings {
141
142
Metadata : & core.Metadata {
142
143
Name : "my-settings" ,
143
144
Namespace : defaults .GlooSystem ,
144
145
},
145
146
},
146
147
clientBuilder .WithObjects (clientObjects ... ).Build (),
147
- CompleteInputSnapshotGVKs , // do not include the Deployment GVK
148
+ iosnapshot . CompleteInputSnapshotGVKs , // do not include the Deployment GVK
148
149
)
149
150
})
150
151
@@ -377,11 +378,11 @@ var _ = Describe("History", func() {
377
378
},
378
379
}
379
380
380
- history = NewHistory (
381
+ history = iosnapshot . NewHistory (
381
382
historyFactorParams .Cache ,
382
383
historyFactorParams .Settings ,
383
384
clientBuilder .WithObjects (clientObjects ... ).Build (),
384
- CompleteInputSnapshotGVKs )
385
+ iosnapshot . CompleteInputSnapshotGVKs )
385
386
})
386
387
387
388
Context ("Kubernetes Core Resources" , func () {
@@ -663,11 +664,11 @@ var _ = Describe("History", func() {
663
664
Context ("GetEdgeApiSnapshot" , func () {
664
665
665
666
BeforeEach (func () {
666
- history = NewHistory (
667
+ history = iosnapshot . NewHistory (
667
668
historyFactorParams .Cache ,
668
669
historyFactorParams .Settings ,
669
670
clientBuilder .Build (), // no objects, because this API doesn't rely on the kube client
670
- CompleteInputSnapshotGVKs ,
671
+ iosnapshot . CompleteInputSnapshotGVKs ,
671
672
)
672
673
})
673
674
@@ -758,11 +759,11 @@ var _ = Describe("History", func() {
758
759
Context ("GetProxySnapshot" , func () {
759
760
760
761
BeforeEach (func () {
761
- history = NewHistory (
762
+ history = iosnapshot . NewHistory (
762
763
historyFactorParams .Cache ,
763
764
historyFactorParams .Settings ,
764
765
clientBuilder .Build (), // no objects, because this API doesn't rely on the kube client
765
- CompleteInputSnapshotGVKs ,
766
+ iosnapshot . CompleteInputSnapshotGVKs ,
766
767
)
767
768
})
768
769
@@ -794,7 +795,7 @@ var _ = Describe("History", func() {
794
795
795
796
})
796
797
797
- func getInputSnapshotObjects (ctx context.Context , history History ) []client.Object {
798
+ func getInputSnapshotObjects (ctx context.Context , history iosnapshot. History ) []client.Object {
798
799
snapshotResponse := history .GetInputSnapshot (ctx )
799
800
Expect (snapshotResponse .Error ).NotTo (HaveOccurred ())
800
801
@@ -804,7 +805,7 @@ func getInputSnapshotObjects(ctx context.Context, history History) []client.Obje
804
805
return responseObjects
805
806
}
806
807
807
- func getProxySnapshotResources (ctx context.Context , history History ) []crdv1.Resource {
808
+ func getProxySnapshotResources (ctx context.Context , history iosnapshot. History ) []crdv1.Resource {
808
809
snapshotResponse := history .GetProxySnapshot (ctx )
809
810
Expect (snapshotResponse .Error ).NotTo (HaveOccurred ())
810
811
@@ -814,7 +815,7 @@ func getProxySnapshotResources(ctx context.Context, history History) []crdv1.Res
814
815
return responseObjects
815
816
}
816
817
817
- func getEdgeApiSnapshot (ctx context.Context , history History ) * v1snap.ApiSnapshot {
818
+ func getEdgeApiSnapshot (ctx context.Context , history iosnapshot. History ) * v1snap.ApiSnapshot {
818
819
snapshotResponse := history .GetEdgeApiSnapshot (ctx )
819
820
Expect (snapshotResponse .Error ).NotTo (HaveOccurred ())
820
821
@@ -827,7 +828,7 @@ func getEdgeApiSnapshot(ctx context.Context, history History) *v1snap.ApiSnapsho
827
828
// setSnapshotOnHistory sets the ApiSnapshot on the history, and blocks until it has been processed
828
829
// This is a utility method to help developers write tests, without having to worry about the asynchronous
829
830
// nature of the `Set` API on the History
830
- func setSnapshotOnHistory (ctx context.Context , history History , snap * v1snap.ApiSnapshot ) {
831
+ func setSnapshotOnHistory (ctx context.Context , history iosnapshot. History , snap * v1snap.ApiSnapshot ) {
831
832
gwSignal := & gatewayv1.Gateway {
832
833
// We append a custom Gateway to the Snapshot, and then use that object
833
834
// to verify the Snapshot has been processed
0 commit comments