@@ -15,10 +15,12 @@ import (
1515 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1616 "k8s.io/client-go/kubernetes/fake"
1717
18- v1alpha1 "github.com/kedacore/http-add-on/operator/apis/http/v1alpha1"
18+ "github.com/kedacore/http-add-on/operator/apis/http/v1alpha1"
1919 "github.com/kedacore/http-add-on/pkg/routing/test"
2020)
2121
22+ const testCustomContent = `<html><body>{{.ServiceName}}</body></html>`
23+
2224func TestNewPlaceholderHandler (t * testing.T ) {
2325 k8sClient := fake .NewSimpleClientset ()
2426 routingTable := test .NewTable ()
@@ -259,7 +261,6 @@ func TestGetTemplate_Caching(t *testing.T) {
259261 routingTable := test .NewTable ()
260262 handler , _ := NewPlaceholderHandler (k8sClient , routingTable )
261263
262- customContent := `<html><body>{{.ServiceName}}</body></html>`
263264 hso := & v1alpha1.HTTPScaledObject {
264265 ObjectMeta : metav1.ObjectMeta {
265266 Name : "test-app" ,
@@ -268,7 +269,7 @@ func TestGetTemplate_Caching(t *testing.T) {
268269 },
269270 Spec : v1alpha1.HTTPScaledObjectSpec {
270271 PlaceholderConfig : & v1alpha1.PlaceholderConfig {
271- Content : customContent ,
272+ Content : testCustomContent ,
272273 },
273274 },
274275 }
@@ -373,7 +374,6 @@ func TestGetTemplate_ConcurrentAccess(t *testing.T) {
373374 routingTable := test .NewTable ()
374375 handler , _ := NewPlaceholderHandler (k8sClient , routingTable )
375376
376- customContent := `<html><body>{{.ServiceName}}</body></html>`
377377 hso := & v1alpha1.HTTPScaledObject {
378378 ObjectMeta : metav1.ObjectMeta {
379379 Name : "test-app" ,
@@ -382,7 +382,7 @@ func TestGetTemplate_ConcurrentAccess(t *testing.T) {
382382 },
383383 Spec : v1alpha1.HTTPScaledObjectSpec {
384384 PlaceholderConfig : & v1alpha1.PlaceholderConfig {
385- Content : customContent ,
385+ Content : testCustomContent ,
386386 },
387387 },
388388 }
@@ -439,7 +439,6 @@ func TestGetTemplate_ConcurrentFirstAccess(t *testing.T) {
439439 routingTable := test .NewTable ()
440440 handler , _ := NewPlaceholderHandler (k8sClient , routingTable )
441441
442- customContent := `<html><body>{{.ServiceName}}</body></html>`
443442 hso := & v1alpha1.HTTPScaledObject {
444443 ObjectMeta : metav1.ObjectMeta {
445444 Name : "test-app" ,
@@ -448,7 +447,7 @@ func TestGetTemplate_ConcurrentFirstAccess(t *testing.T) {
448447 },
449448 Spec : v1alpha1.HTTPScaledObjectSpec {
450449 PlaceholderConfig : & v1alpha1.PlaceholderConfig {
451- Content : customContent ,
450+ Content : testCustomContent ,
452451 },
453452 },
454453 }
0 commit comments