Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #8

Open
wants to merge 110 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
e7e4d21
fill variables
wsiwecki Jun 5, 2023
8599c38
set up variables
Jun 5, 2023
bf93c20
update vars
Jun 5, 2023
4e49189
correct VM definition
Jun 12, 2023
9efca38
correct VM definition
Jun 12, 2023
6c92403
update ssh vars
Jun 14, 2023
9f1a7cf
delete dupicate definition
Jun 15, 2023
050da69
update data
Jun 15, 2023
b7ec5c3
update location
Jun 15, 2023
59c47a8
update locations
Jun 15, 2023
38b2a93
chnange vm definition NIC
Jun 15, 2023
89ec968
try other vars
Jun 15, 2023
3837880
Working version
Jun 15, 2023
b5e7007
add hostname
Jun 15, 2023
d1df001
update PublishTestResults@2 Postman
Jun 15, 2023
00077f3
change pool
Jun 15, 2023
c7ab3d4
comment ubnet
Jun 20, 2023
6bfd28c
update data
Jun 20, 2023
2c24d4a
update task names
Jun 20, 2023
8cdf3e7
back witj full name tasks
Jun 20, 2023
f322259
update taks names
Jun 20, 2023
c268763
update Azure data
Jun 20, 2023
8db05e9
comment FakeRestAPI
Jun 20, 2023
494e84d
def. env
Jun 20, 2023
5158f77
update env
Jun 20, 2023
940ce16
comment FakeRestAPI
Jun 20, 2023
714790b
update azureServiceConncetionId
Jun 20, 2023
bb297b2
update once more conn
Jun 20, 2023
37edc6a
uncomment FakeRestAPI
Jun 20, 2023
8a8ec9d
update VM imgae
Jun 20, 2023
b3b44a4
correct syntax
Jun 20, 2023
f6811bb
Update auth data
Jun 26, 2023
5831916
update azure pipeline tfstate
Jun 26, 2023
c70a1dd
updat etasknames
Jun 26, 2023
26ae1cc
change path
Jun 26, 2023
319b8ff
other path Terraforminstaller
Jun 26, 2023
081b8de
back to org
Jun 26, 2023
336d485
change number
Jun 26, 2023
039da8d
del path
Jun 26, 2023
17de8f8
change ab. terraforminstaller
Jun 26, 2023
c4ed461
update auth data
Jun 28, 2023
99656b0
update paths
Jun 28, 2023
24650d8
update auth data
Jun 29, 2023
cfb124b
update client data and vm
Jun 29, 2023
6bd052c
update auth data
Jun 29, 2023
48937aa
change secret
Jun 29, 2023
a57170e
new secret
Jun 29, 2023
d7bbf4c
update new auth datat
Jun 29, 2023
31dcf6f
update auth data
Jun 30, 2023
11817d3
update app name
Jun 30, 2023
67a1a1b
update app name
Jun 30, 2023
7a88427
update tfstate disk
Jun 30, 2023
889e860
add file for postman
Jun 30, 2023
dcbac76
add postman file
Jun 30, 2023
fee46f8
add file 2222
Jun 30, 2023
2e5d1e4
ooo
Jun 30, 2023
30035fa
add test file
Jun 30, 2023
17fa9c3
file t
Jun 30, 2023
4c9008e
ad empty files
Jun 30, 2023
7ffe010
update postman data
Jun 30, 2023
6b96757
update regression data
Jun 30, 2023
378ac60
remove file
Jun 30, 2023
a058619
add Regression file
Jun 30, 2023
568f342
fill up part TO DO
Jul 7, 2023
205fa14
change AzSubrsription
Jul 7, 2023
98976a3
update conn auth
Jul 7, 2023
8bed8a8
try this FakeRestAPI path
Jul 7, 2023
c9bc3c2
set up paths
Jul 10, 2023
a6bd1b3
update fakerestapi path
Jul 10, 2023
ae76cd3
other paths for api
Jul 10, 2023
f4332fb
update url to jmeter
Jul 10, 2023
6c3c2c1
update file ext
Jul 10, 2023
ad147c8
update jmeter ver
Jul 10, 2023
824dfdd
change working dir
Jul 10, 2023
19e724f
check path
Jul 10, 2023
624c2ff
update path
Jul 10, 2023
123e1f6
change path to artigact name
Jul 10, 2023
5fb4fa2
change dirs
Jul 10, 2023
ef1316b
try next 1
Jul 10, 2023
c4e7f85
path try 2
Jul 10, 2023
3d92988
try 3
Jul 10, 2023
bd8e3cd
change env name
Jul 10, 2023
91a9b26
back
Jul 10, 2023
e63d1f1
reapir error
Jul 10, 2023
922379d
comment tags
Jul 10, 2023
4a71729
update rName
Jul 10, 2023
05fa066
other name for selenium
Jul 10, 2023
e4168ba
back with name
Jul 10, 2023
c59953c
change artifact path
Jul 15, 2023
3922cfe
next change artifact
Jul 15, 2023
8ae487d
rename file jmx
Jul 15, 2023
225ba76
check with other path
Jul 15, 2023
afe8091
reapir file name
Jul 15, 2023
14c04b4
change syntax
Jul 15, 2023
7ad036a
update variables
Jul 18, 2023
629e3c7
change VM name
Jul 18, 2023
85f8fcf
back env name
Jul 18, 2023
b0c60f8
remove tag
Jul 18, 2023
9005593
update VMDeployment
Jul 19, 2023
6253db8
comment out parameters
Jul 19, 2023
2ef11f0
change env
Jul 20, 2023
3886722
add tags
Jul 20, 2023
a334841
uncomment selenium
Jul 20, 2023
dd86688
add selenium file
Jul 20, 2023
3c04d93
change username in bash
Jul 20, 2023
81d76b7
fill selenium
Jul 20, 2023
56e836c
add files
Jul 20, 2023
cc3c5f1
change url
Jul 20, 2023
e92511f
correct syntax
Jul 20, 2023
34e0d2f
change RG to azuredevops2
Aug 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions automatedtesting/postman/TestSuite.Data-Validation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"postId": 1,
"id": 1,
"name": "Labore Laborum",
"salary": "1000",
"age": "34"
},
{
"postId": 1,
"id": 2,
"name": "Reiciendis Earum",
"salary": "1200",
"age": "26"
},
{
"postId": 1,
"id": 3,
"name": "Adipisci Animi",
"salary": "3500",
"age": "55"
},
{
"postId": 1,
"id": 4,
"name": "Alias Sit",
"salary": "2100",
"age": "42"
},
{
"postId": 1,
"id": 5,
"name": "Vero Eaque",
"salary": "4243",
"age": "47"
}
]
37 changes: 37 additions & 0 deletions automatedtesting/postman/TestSuite.Regression.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"postId": 1,
"id": 1,
"name": "Labore Laborum",
"salary": "1000",
"age": "34"
},
{
"postId": 1,
"id": 2,
"name": "Reiciendis Earum",
"salary": "1200",
"age": "26"
},
{
"postId": 1,
"id": 3,
"name": "Adipisci Animi",
"salary": "3500",
"age": "55"
},
{
"postId": 1,
"id": 4,
"name": "Alias Sit",
"salary": "2100",
"age": "42"
},
{
"postId": 1,
"id": 5,
"name": "Vero Eaque",
"salary": "4243",
"age": "47"
}
]
8 changes: 8 additions & 0 deletions automatedtesting/selenium/add_remove_from_cart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# #!/usr/bin/env python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions

# Start the browser and navigate to webpage
driver = webdriver.Chrome()
driver.get('https://wswebapplication-appservice.azurewebsites.net/automatedtesting/selenium/login.py')
#driver.get(https://wswebapplication-appservice.azurewebsites.net/automatedtesting/selenium/login.py')
6 changes: 3 additions & 3 deletions automatedtesting/selenium/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
def login (user, password):
print ('Starting the browser...')
# --uncomment when running in Azure DevOps.
# options = ChromeOptions()
# options.add_argument("--headless")
# driver = webdriver.Chrome(options=options)
options = ChromeOptions()
options.add_argument("--headless")
driver = webdriver.Chrome(options=options)
driver = webdriver.Chrome()
print ('Browser started successfully. Navigating to the demo page to login.')
driver.get('https://www.saucedemo.com/')
Expand Down
Empty file.
Empty file.
59 changes: 34 additions & 25 deletions azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ trigger:
# ToDo: Replace the agent pool name, if you are using Udacity Cloud lab.
# Otherwise, comment out the line below.
pool: myAgentPool
#pool: "Azure Pipelines"

variables:
python.version: '3.7.6'
# ToDo: Replace the service connection name as used in the DevOps project settings
azureServiceConnectionId: 'myServiceConnection'
azureServiceConnectionId: 'AzureRMconn3' #'myServiceConnection'
# Project root folder. Point to the folder containing manage.py file.
projectRoot: $(System.DefaultWorkingDirectory)
# Environment name
environmentName: 'test'
environmentName: 'linux-test3'

stages:
#--------------------------------------------#
Expand All @@ -33,7 +34,8 @@ stages:
- task: ms-devlabs.custom-terraform-tasks.custom-terraform-installer-task.TerraformInstaller@0
displayName: 'Terrafom installation'
inputs:
terraformVersion: '1.2.9'
# terraformVersion: '1.2.9'
terraformVersion: 'latest'

# Run Terraform Init on the pipeline agent
# ToDo: Replace the resource group name, storage account name, and container name below
Expand All @@ -44,9 +46,9 @@ stages:
command: 'init'
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform/environments/test'
backendServiceArm: '$(azureServiceConnectionId)'
backendAzureRmResourceGroupName: ''
backendAzureRmStorageAccountName: ''
backendAzureRmContainerName: ''
backendAzureRmResourceGroupName: 'Azuredevops2'
backendAzureRmStorageAccountName: 'tfstate635024562'
backendAzureRmContainerName: 'tfstate'
backendAzureRmKey: 'test.terraform.tfstate'

- task: ms-devlabs.custom-terraform-tasks.custom-terraform-release-task.TerraformTaskV3@3
Expand Down Expand Up @@ -121,9 +123,9 @@ stages:
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TEST-*.xml'
searchFolder: # ToDo
searchFolder: '$(System.DefaultWorkingDirectory)' # ToDo
mergeTestResults: true
testRunTitle: # ToDo
testRunTitle: Test_Demo # ToDo

#--------------------------------------------#
# Selenium (UI) Test Suite - Archive the package
Expand All @@ -146,7 +148,7 @@ stages:
- task: ArchiveFiles@2
displayName: 'Archive FakeRestAPI'
inputs:
rootFolderOrFile:
rootFolderOrFile:
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)-fakerestapi.zip'
Expand Down Expand Up @@ -179,46 +181,53 @@ stages:
# ToDo: Provide <environment name> you created in your DevOps project
- deployment: FakeRestAPI
pool:
vmImage: 'Ubuntu-18.04'
environment: <environment name> # ToDo
vmImage: 'Ubuntu-20.04'
environment: '$(environmentName)' # ToDo
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
displayName: 'Deploy Azure Web App'
inputs:
azureSubscription: '' # ToDo
appName: '' # ToDo
azureSubscription: 'AzureRMconn3' # ToDo
appName: 'wswebApplication-AppService' # ToDo
appType: webApp
package: $(Pipeline.Workspace)/<artifact>/<archiveFile> # ToDo: Use the published zip artifact.
# package: $(Build.ArtifactStagingDirectory)/$(Build.BuildId)-fakerestapi.zip # ToDo: Use the published zip artifact.
package: $(Pipeline.Workspace)/drop-fakerestapi/$(Build.BuildId)-fakerestapi.zip # ToDo: Use the published zip artifact.
# package: $(Pipeline.Workspace)/a/$(Build.BuildId)-fakerestapi.zip # ToDo: Use the published zip artifact.
# package: $(Pipeline.Workspace)/<artifact>/<archiveFile> # ToDo: Use the published zip artifact.
#--------------------------------------------#
# Run JMeter test suite against the App Service
- task: CmdLine@2
inputs:
script: |
wget "https://apache.mirrors.lucidnetworks.net//jmeter/binaries/apache-jmeter-5.2.1.tgz"
tar -xf apache-jmeter-5.2.1.tgz
wget "https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-5.6.tgz"
tar -xf apache-jmeter-5.6.tgz
unzip -o $(Build.BuildId)-perftests.zip
./apache-jmeter-5.2.1/bin/jmeter -n -t PerformanceTestSuite.jmx -j jmeter.log -f
./apache-jmeter-5.6/bin/jmeter -n -t automatedtesting/jmeter/PerformanceTestSuite.jmx -j jmeter.log -f
cat jmeter.log # ToDo: Write your commands
workingDirectory: $(Pipeline.Workspace)/<artifact> # ToDo: Use the artifact name from the task above
workingDirectory: $(Pipeline.Workspace)/drop-perftests # ToDo: Use the artifact name from the task above
# workingDirectory: $(Pipeline.Workspace)/drop-fakerestapi # ToDo: Use the artifact name from the task above
# workingDirectory: $(Pipeline.Workspace)/<artifact> # ToDo: Use the artifact name from the task above

#--------------------------------------------#
# Selenium | Functional UI Tests
# ToDo:
- deployment: VMDeploy
displayName: Selenium Tests
displayName: Selenium UI Tests
environment:
name: # ToDo: Change/provide a name
name: '$(environmentName)'
resourceType: VirtualMachine
# name: "linux-test" # ToDo: Change/provide a name
# resourceType: VirtualMachine
tags: selenium
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop-ui-tests # ToDo: Change/provide a name
artifact: drop-uitests # ToDo: Change/provide a name

- task: Bash@3
inputs:
Expand All @@ -232,21 +241,21 @@ stages:
sudo apt-get install -y chromium-browser
pip3 install selenium
cd ~/
DIR=/home/testuser/app
DIR=/home/adminuser/app
if [ ! -d "$DIR" ]; then
mkdir app
fi
mv /home/testuser/azagent/_work/1/drop-uitests/$(Build.BuildId)-uitests.zip app
mv /home/adminuser/azagent/_work/1/drop-uitests/$(Build.BuildId)-uitests.zip app
cd app
unzip -o $(Build.BuildId)-uitests.zip
FILE=/home/testuser/app/chromedriver_linux64.zip
FILE=/home/adminuser/app/chromedriver_linux64.zip
if [ ! -f "$FILE" ]; then
LATEST=$(wget -q -O - http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
wget http://chromedriver.storage.googleapis.com/$LATEST/chromedriver_linux64.zip
unzip -o chromedriver_linux64.zip
sudo ln -s $PWD/chromedriver /usr/local/bin/chromedriver
fi
export PATH=$PATH:/home/testuser/app
export PATH=$PATH:/home/adminuser/app
echo "Starting Selenium Tests"
python3 add_remove_from_cart.py >> selenium.log
echo "Completed Selenium Tests. Check selenium.log for results."
21 changes: 21 additions & 0 deletions terraform/environments/test/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
RESOURCE_GROUP_NAME="Azuredevops"
STORAGE_ACCOUNT_NAME="tfstate$RANDOM$RANDOM"
CONTAINER_NAME="tfstate"

# This command is not needed in the Udacity provided Azure account.
# Create resource group
# az group create --name $RESOURCE_GROUP_NAME --location eastus

# Create storage account
az storage account create --resource-group $RESOURCE_GROUP_NAME --name $STORAGE_ACCOUNT_NAME --sku Standard_LRS --encryption-services blob

# Get storage account key
ACCOUNT_KEY=$(az storage account keys list --resource-group $RESOURCE_GROUP_NAME --account-name $STORAGE_ACCOUNT_NAME --query '[0].value' -o tsv)
export ARM_ACCESS_KEY=$ACCOUNT_KEY

# Create blob container
az storage container create --name $CONTAINER_NAME --account-name $STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY
echo "RESOURCE_GROUP_NAME=$RESOURCE_GROUP_NAME"
echo "STORAGE_ACCOUNT_NAME=$STORAGE_ACCOUNT_NAME"
echo "CONTAINER_NAME=$CONTAINER_NAME"
echo "ACCOUNT_KEY=$ACCOUNT_KEY"

4 changes: 4 additions & 0 deletions terraform/environments/test/input.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ variable "tenant_id" {}
# Resource Group/Location
variable "location" {}
variable "resource_group" {}
variable "resource_group_name" {}
variable "application_type" {}

# Network
variable virtual_network_name {}
variable address_prefix_test {}
variable address_prefixes_test {}
variable address_space {}

# VM
#variable subnet_id {}
42 changes: 29 additions & 13 deletions terraform/environments/test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,42 @@ provider "azurerm" {
client_secret = "${var.client_secret}"
features {}
}

terraform {
backend "azurerm" {
storage_account_name = ""
container_name = ""
key = ""
access_key = ""
storage_account_name = "tfstate635024562"
container_name = "tfstate"
key = "test.terraform.tfstate"
access_key = "qXly88km6RjjLdisH+W+rvJxRQCqLOjuAGVd1AdZ0SfFvNsjuYJ/mYU2UzpHe2pl6hr0Ncsbu5cg+AStAEYcag=="
}
}
module "resource_group" {
source = "../../modules/resource_group"
resource_group = "${var.resource_group}"
location = "${var.location}"
}

#module "resource_group" {
# source = "../../modules/resource_group"
# resource_group = "${var.resource_group}"
# location = "${var.location}"
#}

module "network" {
source = "../../modules/network"
address_space = "${var.address_space}"
location = "${var.location}"
virtual_network_name = "${var.virtual_network_name}"
application_type = "${var.application_type}"
resource_type = "NET"
resource_group = "${module.resource_group.resource_group_name}"
# resource_group = "${module.resource_group.resource_group_name}"
resource_group = "${var.resource_group}"
address_prefix_test = "${var.address_prefix_test}"
address_prefixes_test = "${var.address_prefixes_test}"
}

module "nsg-test" {
source = "../../modules/networksecuritygroup"
location = "${var.location}"
application_type = "${var.application_type}"
resource_type = "NSG"
resource_group = "${module.resource_group.resource_group_name}"
# resource_group = "${module.resource_group.resource_group_name}"
resource_group = "${var.resource_group}"
subnet_id = "${module.network.subnet_id_test}"
address_prefix_test = "${var.address_prefix_test}"
}
Expand All @@ -43,12 +49,22 @@ module "appservice" {
location = "${var.location}"
application_type = "${var.application_type}"
resource_type = "AppService"
resource_group = "${module.resource_group.resource_group_name}"
resource_group = "${var.resource_group}"
# resource_group = "${module.resource_group.resource_group_name}"
}
module "publicip" {
source = "../../modules/publicip"
location = "${var.location}"
application_type = "${var.application_type}"
resource_type = "publicip"
resource_group = "${module.resource_group.resource_group_name}"
resource_group = "${var.resource_group}"
}
module "vm" {
source = "../../modules/vm"
location = "${var.location}"
application_type = "${var.application_type}"
resource_type = "VM"
resource_group = "${var.resource_group}"
subnet_id = "${module.network.subnet_id_test}"
public_ip_address_id = "${module.publicip.public_ip_address_id}"
}
Loading