Repository: Azure/ARO-RP
Pull request #2468 (2022-10-18 08:30:47)

Adds selenium teardown to E2E: follow-up
### Which issue this PR addresses:

Follow-up for https://github.com/Azure/ARO-RP/pull/2467
### What this PR does / why we need it:

Moves container name into constant

### Test plan for issue:

Run E2E

### Is there any documentation that needs to be updated for this PR?

No, just refactoring.



Patch:
diff --git a/pkg/deploy/assets/env-development.json b/pkg/deploy/assets/env-development.json
index 3d4c18306..8cd810d69 100644
--- a/pkg/deploy/assets/env-development.json
+++ b/pkg/deploy/assets/env-development.json
@@ -407,7 +407,7 @@
                                     "autoUpgradeMinorVersion": true,
                                     "settings": {},
                                     "protectedSettings": {
-                                        "script": "[base64(concat(base64ToString('c2V0IC1leAoK'),'PROXYIMAGE=$(base64 -d \u003c\u003c\u003c''',base64(parameters('proxyImage')),''')\n','PROXYIMAGEAUTH=$(base64 -d \u003c\u003c\u003c''',base64(parameters('proxyImageAuth')),''')\n','PROXYCERT=''',parameters('proxyCert'),'''\n','PROXYCLIENTCERT=''',parameters('proxyClientCert'),'''\n','PROXYKEY=''',parameters('proxyKey'),'''\n','\n',base64ToString('eXVtIC15IHVwZGF0ZQp5dW0gLXkgaW5zdGFsbCBkb2NrZXIKCmZpcmV3YWxsLWNtZCAtLWFkZC1wb3J0PTQ0My90Y3AgLS1wZXJtYW5lbnQKCm1rZGlyIC9yb290Ly5kb2NrZXIKY2F0ID4vcm9vdC8uZG9ja2VyL2NvbmZpZy5qc29uIDw8RU9GCnsKCSJhdXRocyI6IHsKCQkiJHtQUk9YWUlNQUdFJSUvKn0iOiB7CgkJCSJhdXRoIjogIiRQUk9YWUlNQUdFQVVUSCIKCQl9Cgl9Cn0KRU9GCnN5c3RlbWN0bCBzdGFydCBkb2NrZXIuc2VydmljZQpkb2NrZXIgcHVsbCAiJFBST1hZSU1BR0UiCgpta2RpciAvZXRjL3Byb3h5CmJhc2U2NCAtZCA8PDwiJFBST1hZQ0VSVCIgPi9ldGMvcHJveHkvcHJveHkuY3J0CmJhc2U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CkgJgo=')))]"
+                                        "script": "[base64(concat(base64ToString('c2V0IC1leAoK'),'PROXYIMAGE=$(base64 -d \u003c\u003c\u003c''',base64(parameters('proxyImage')),''')\n','PROXYIMAGEAUTH=$(base64 -d \u003c\u003c\u003c''',base64(parameters('proxyImageAuth')),''')\n','PROXYCERT=''',parameters('proxyCert'),'''\n','PROXYCLIENTCERT=''',parameters('proxyClientCert'),'''\n','PROXYKEY=''',parameters('proxyKey'),'''\n','\n',base64ToString('eXVtIC15IHVwZGF0ZQp5dW0gLXkgaW5zdGFsbCBkb2NrZXIKCmZpcmV3YWxsLWNtZCAtLWFkZC1wb3J0PTQ0My90Y3AgLS1wZXJtYW5lbnQKCm1rZGlyIC9yb290Ly5kb2NrZXIKY2F0ID4vcm9vdC8uZG9ja2VyL2NvbmZpZy5qc29uIDw8RU9GCnsKCSJhdXRocyI6IHsKCQkiJHtQUk9YWUlNQUdFJSUvKn0iOiB7CgkJCSJhdXRoIjogIiRQUk9YWUlNQUdFQVVUSCIKCQl9Cgl9Cn0KRU9GCnN5c3RlbWN0bCBzdGFydCBkb2NrZXIuc2VydmljZQpkb2NrZXIgcHVsbCAiJFBST1hZSU1BR0UiCgpta2RpciAvZXRjL3Byb3h5CmJhc2U2NCAtZCA8PDwiJFBST1hZQ0VSVCIgPi9ldGMvcHJveHkvcHJveHkuY3J0CmJhc2U2NCAtZCA8PDwiJFBST1hZS0VZIiA+L2V0Yy9wcm94eS9wcm94eS5rZXkKYmFzZTY0IC1kIDw8PCIkUFJPWFlDTElFTlRDRVJUIiA+L2V0Yy9wcm94eS9wcm94eS1jbGllbnQuY3J0CmNob3duIC1SIDEwMDA6MTAwMCAvZXRjL3Byb3h5CmNobW9kIDA2MDAgL2V0Yy9wcm94eS9wcm94eS5rZXkKCmNhdCA+L2V0Yy9zeXNjb25maWcvcHJveHkgPDxFT0YKUFJPWFlfSU1BR0U9JyRQUk9YWUlNQUdFJwpFT0YKCmNhdCA+L2V0Yy9zeXN0ZW1kL3N5c3RlbS9wcm94eS5zZXJ2aWNlIDw8J0VPRicKW1VuaXRdCkFmdGVyPWRvY2tlci5zZXJ2aWNlClJlcXVpcmVzPWRvY2tlci5zZXJ2aWNlCgpbU2VydmljZV0KRW52aXJvbm1lbnRGaWxlPS9ldGMvc3lzY29uZmlnL3Byb3h5CkV4ZWNTdGFydFByZT0tL3Vzci9iaW4vZG9ja2VyIHJtIC1mICVuCkV4ZWNTdGFydD0vdXNyL2Jpbi9kb2NrZXIgcnVuIC0tcm0gLS1uYW1lICVuIC1wIDQ0Mzo4NDQzIC12IC9ldGMvcHJveHk6L3NlY3JldHMgJFBST1hZX0lNQUdFCkV4ZWNTdG9wPS91c3IvYmluL2RvY2tlciBzdG9wICVuClJlc3RhcnQ9YWx3YXlzClJlc3RhcnRTZWM9MQpTdGFydExpbWl0SW50ZXJ2YWw9MAoKW0luc3RhbGxdCldhbnRlZEJ5PW11bHRpLXVzZXIudGFyZ2V0CkVPRgoKc3lzdGVtY3RsIGVuYWJsZSBwcm94eS5zZXJ2aWNlCgpjYXQgPi9ldGMvY3Jvbi53ZWVrbHkvcHVsbC1pbWFnZSA8PCdFT0YnCiMhL2Jpbi9iYXNoCgpkb2NrZXIgcHVsbCAkUFJPWFlJTUFHRQpzeXN0ZW1jdGwgcmVzdGFydCBwcm94eS5zZXJ2aWNlCkVPRgpjaG1vZCAreCAvZXRjL2Nyb24ud2Vla2x5L3B1bGwtaW1hZ2UKCmNhdCA+L2V0Yy9jcm9uLndlZWtseS95dW11cGRhdGUgPDwnRU9GJwojIS9iaW4vYmFzaAoKeXVtIHVwZGF0ZSAteQpFT0YKY2htb2QgK3ggL2V0Yy9jcm9uLndlZWtseS95dW11cGRhdGUKCihzbGVlcCAzMDsgcmVib290KSAmCg==')))]"
                                     }
                                 }
                             }
diff --git a/pkg/deploy/generator/resources_dev.go b/pkg/deploy/generator/resources_dev.go
index 65f30bb1b..79da356ea 100644
--- a/pkg/deploy/generator/resources_dev.go
+++ b/pkg/deploy/generator/resources_dev.go
@@ -87,6 +87,14 @@ EOF
 
 systemctl enable proxy.service
 
+cat >/etc/cron.weekly/pull-image <<'EOF'
+#!/bin/bash
+
+docker pull $PROXYIMAGE
+systemctl restart proxy.service
+EOF
+chmod +x /etc/cron.weekly/pull-image
+
 cat >/etc/cron.weekly/yumupdate <<'EOF'
 #!/bin/bash
 


Test patch:
diff --git a/test/e2e/setup.go b/test/e2e/setup.go
index c1e5df9eb..e3b2865c5 100644
--- a/test/e2e/setup.go
+++ b/test/e2e/setup.go
@@ -45,6 +45,8 @@ import (
 	"github.com/Azure/ARO-RP/test/util/kubeadminkubeconfig"
 )
 
+const seleniumContainerName = "selenium-edge-standalone"
+
 type clientSet struct {
 	OpenshiftClustersv20200430 redhatopenshift20200430.OpenShiftClustersClient
 	Operationsv20200430        redhatopenshift20200430.OperationsClient
@@ -310,7 +312,7 @@ func setupSelenium(ctx context.Context) error {
 
 	log.Infof("Selenium Image Pull Output : %s\n", output)
 
-	cmd = exec.CommandContext(ctx, "docker", "run", "-d", "-p", "4444:4444", "--name", "selenium-edge-standalone", "--network=host", "--shm-size=2g", "selenium/standalone-edge:latest")
+	cmd = exec.CommandContext(ctx, "docker", "run", "-d", "-p", "4444:4444", "--name", seleniumContainerName, "--network=host", "--shm-size=2g", "selenium/standalone-edge:latest")
 	output, err = cmd.CombinedOutput()
 	if err != nil {
 		log.Fatalf("Error occurred starting selenium grid\n Output: %s\n Error: %s\n", output, err)
@@ -323,14 +325,14 @@ func setupSelenium(ctx context.Context) error {
 
 func tearDownSelenium(ctx context.Context) error {
 	log.Infof("Stopping Selenium Grid")
-	cmd := exec.CommandContext(ctx, "docker", "stop", "selenium-edge-standalone")
+	cmd := exec.CommandContext(ctx, "docker", "stop", seleniumContainerName)
 	output, err := cmd.CombinedOutput()
 	if err != nil {
 		log.Fatalf("Error occurred stopping selenium container\n Output: %s\n Error: %s\n", output, err)
 	}
 
 	log.Infof("Removing Selenium Grid container")
-	cmd = exec.CommandContext(ctx, "docker", "rm", "selenium-edge-standalone")
+	cmd = exec.CommandContext(ctx, "docker", "rm", seleniumContainerName)
 	output, err = cmd.CombinedOutput()
 	if err != nil {
 		log.Fatalf("Error occurred removing selenium grid container\n Output: %s\n Error: %s\n", output, err)