From d0ae9dde25df0a2c27d4a1de8fe3877b083b2352 Mon Sep 17 00:00:00 2001 From: Gauri Prasad <51212198+gapra-msft@users.noreply.github.com> Date: Mon, 7 Nov 2022 08:22:32 -0800 Subject: [PATCH] Added proxy test to code coverage pipeline (#961) --- blobfuse2-code-coverage.yaml | 83 +++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/blobfuse2-code-coverage.yaml b/blobfuse2-code-coverage.yaml index 989c5d67..aeec9c55 100644 --- a/blobfuse2-code-coverage.yaml +++ b/blobfuse2-code-coverage.yaml @@ -179,6 +179,7 @@ stages: workingDirectory: $(WORK_DIR) displayName: "Block Blob Coverage with profilers" + # Config Generation (ADLS) - script: | cd $(WORK_DIR) $(WORK_DIR)/blobfuse2 gen-test-config --config-file=azure_key.yaml --container-name=$(containerName) --temp-path=$(TEMP_DIR) --output-file=$(BLOBFUSE2_ADLS_CFG) @@ -192,7 +193,7 @@ stages: displayName: 'Create Config File - ADLS' continueOnError: false - # Code Coverage with e2e-tests for adls blob + # Code Coverage with e2e-tests for ADLS - script: | rm -rf $(MOUNT_DIR)/* rm -rf $(TEMP_DIR)/* @@ -587,6 +588,86 @@ stages: workingDirectory: $(WORK_DIR) displayName: "CLI : Health monitor stop all" + # Start Proxy + - script: | + sudo apt-get update --fix-missing -y + sudo apt remove mitmproxy -y + sudo apt-get install python3-setuptools -y + sudo apt install python3-pip -y + sudo pip3 install mitmproxy + mitmdump -w proxy_logs.txt & + displayName: 'Install & Start Proxy' + + # Configure Proxy cert & env + - script: | + sudo mkdir /usr/local/share/ca-certificates/extra + sudo cp ~/.mitmproxy/mitmproxy-ca-cert.cer /usr/local/share/ca-certificates/extra/mitmproxy-ca-cert.crt + sudo update-ca-certificates + export https_proxy="127.0.0.1:8080" + export http_proxy="127.0.0.1:8080" + displayName: 'Configure Proxy' + + # Config Generation (Block Blob Proxy) + - script: | + cd $(WORK_DIR) + $(WORK_DIR)/blobfuse2 gen-test-config --config-file=azure_key_proxy.yaml --container-name=$(containerName) --temp-path=$(TEMP_DIR) --output-file=$(BLOBFUSE2_CFG) + env: + NIGHTLY_STO_ACC_NAME: $(NIGHTLY_STO_BLOB_ACC_NAME) + NIGHTLY_STO_ACC_KEY: $(NIGHTLY_STO_BLOB_ACC_KEY) + ACCOUNT_TYPE: 'block' + ACCOUNT_ENDPOINT: 'https://$(NIGHTLY_STO_BLOB_ACC_NAME).blob.core.windows.net' + VERBOSE_LOG: false + USE_HTTP: false + displayName: 'Create Config File - Block Blob Proxy' + workingDirectory: $(WORK_DIR) + continueOnError: false + + # Code Coverage with e2e-tests for block blob Proxy + - script: | + rm -rf $(MOUNT_DIR)/* + rm -rf $(TEMP_DIR)/* + ./blobfuse2.test -test.v -test.coverprofile=$(WORK_DIR)/blobfuse2_block_proxy.cov mount $(MOUNT_DIR) --config-file=$(BLOBFUSE2_CFG) --foreground=true & + sleep 10 + ps -aux | grep blobfuse2 + rm -rf $(MOUNT_DIR)/* + cd test/e2e_tests + go test -v -timeout=7200s ./... -args -mnt-path=$(MOUNT_DIR) -tmp-path=$(TEMP_DIR) + cd - + sudo fusermount -u $(MOUNT_DIR) + sleep 5 + workingDirectory: $(WORK_DIR) + displayName: "Block Blob Coverage Proxy" + + # Config Generation (ADLS Proxy) + - script: | + cd $(WORK_DIR) + $(WORK_DIR)/blobfuse2 gen-test-config --config-file=azure_key_proxy.yaml --container-name=$(containerName) --temp-path=$(TEMP_DIR) --output-file=$(BLOBFUSE2_ADLS_CFG) + env: + NIGHTLY_STO_ACC_NAME: $(AZTEST_ADLS_ACC_NAME) + NIGHTLY_STO_ACC_KEY: $(AZTEST_ADLS_KEY) + ACCOUNT_TYPE: 'adls' + ACCOUNT_ENDPOINT: 'https://$(AZTEST_ADLS_ACC_NAME).dfs.core.windows.net' + VERBOSE_LOG: false + USE_HTTP: false + displayName: 'Create Config File - ADLS Proxy' + continueOnError: false + + # Code Coverage with e2e-tests for ADLS Proxy + - script: | + rm -rf $(MOUNT_DIR)/* + rm -rf $(TEMP_DIR)/* + ./blobfuse2.test -test.v -test.coverprofile=$(WORK_DIR)/blobfuse2_adls_proxy.cov mount $(MOUNT_DIR) --config-file=$(BLOBFUSE2_ADLS_CFG) --foreground=true & + sleep 10 + ps -aux | grep blobfuse2 + rm -rf $(MOUNT_DIR)/* + cd test/e2e_tests + go test -v -timeout=7200s ./... -args -mnt-path=$(MOUNT_DIR) -adls=true -tmp-path=$(TEMP_DIR) + cd - + ./blobfuse2 unmount all + sleep 5 + workingDirectory: $(WORK_DIR) + displayName: "ADLS Coverage Proxy" + # ------------------------------------------------------- # Coverage report consolidation - script: |