Skip to content

Instantly share code, notes, and snippets.

View stephendonner's full-sized avatar

Stephen Donner stephendonner

View GitHub Profile
sdonners-MacBook-Pro:~ sdonner$ git clone https://github.com/stephendonner/mozillians-tests.git
Cloning into 'mozillians-tests'...
remote: Counting objects: 1706, done.
remote: Total 1706 (delta 0), reused 0 (delta 0), pack-reused 1706
Receiving objects: 100% (1706/1706), 326.23 KiB | 134.00 KiB/s, done.
Resolving deltas: 100% (1067/1067), done.
Checking connectivity... done.
sdonners-MacBook-Pro:~ sdonner$ cd mozillians-tests/
sdonners-MacBook-Pro:mozillians-tests sdonner$ git checkout master
Already on 'master'
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
desired_cap = {
'platform': "Windows 10",
>>> import os
>>> print os.environ["SAUCE_USERNAME"]
sdonner
>>> username=os.environ["SAUCE_USERNAME"]
>>> random_string="h18s3lajs192sf"
>>> ' '.join([username, random_string])
'sdonner h18s3lajs192sf'
>>> ':'.join([username, random_string])
'sdonner:h18s3lajs192sf'
**** Molotov v0.2. Happy breaking! ****
[28188] Preparing 1 workers...OK
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GET https://stubattribution-default.stage.mozaws.net//?product=firefox-stub&os=win&lang=en-US&attribution_code=source%3D(not+set)%26medium%3De979b1ff-cd2f-49b3-9d56-31d264a46082%26campaign%3D(not+set)%26content%3D(not+set)%26timestamp%3D1485394232&attribution_sig=8949d50b56601f26793564b99650b50d881a57a5671605ba934184febbbfec26
Accept-Encoding: gzip, deflate
Accept: */*
Host: stubattribution-default.stage.mozaws.net
User-Agent: Python/3.5 aiohttp/1.2.0
Content-Length: 0>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GET https://download.mozilla.org/?lang=en-US&os=win&product=firefox-stub
(stubattribution-loadtests) sdonner-17447:stubattribution-loadtests sdonner$ pip install -Ur requirements.txt
Collecting https://github.com/loads/molotov/archive/master.zip (from -r requirements.txt (line 6))
Downloading https://github.com/loads/molotov/archive/master.zip
/ 32kB 420kB/s
Requirement already up-to-date: pytest==3.0.5 in /Users/sdonner/.pyenv/versions/3.5.0/envs/stubattribution-loadtests/lib/python3.5/site-packages (from -r requirements.txt (line 1))
Requirement already up-to-date: pytest-selenium==1.7.0 in /Users/sdonner/.pyenv/versions/3.5.0/envs/stubattribution-loadtests/lib/python3.5/site-packages (from -r requirements.txt (line 2))
Requirement already up-to-date: pytest-variables==1.4 in /Users/sdonner/.pyenv/versions/3.5.0/envs/stubattribution-loadtests/lib/python3.5/site-packages (from -r requirements.txt (line 3))
Requirement already up-to-date: pytest-xdist==1.15.0 in /Users/sdonner/.pyenv/versions/3.5.0/envs/stubattribution-loadtests/lib/python3.5/site-packages (from -r require
@stephendonner
stephendonner / gist:1590887f54703c36f2c1a8e028a3b4f7
Created January 26, 2017 18:59
Step-by-step Stub Attribution flow
Using Chrome on Windows 7+, load https://www-demo4.allizom.org/en-US/
Scroll down to and click on "Get Firefox Today" which takes you to https://www-demo4.allizom.org/en-US/firefox/new/
Now, click on the green "Free Download" button and let it auto-download "Firefox Setup Stub 51.0.1.exe" (it's not the build we want, though)
Context-click on the "click here" link of the "If not, _click here_." orange text, and choose "Copy Link Address"
Next, paste that link into the URL bar, but don't hit enter, yet
This URL should look something like: https://bouncer-bouncer.stage.mozaws.net/?product=firefox-stub&os=win&lang=en-US&attribution_code=source%3Dwww-demo4.allizom.org%26medium%3Dreferral%26campaign%3D%28not+set%29%26content%3D%28not+set%29%26timestamp%3D1483651495&attribution_sig=bbdb0831fd3de35681c7fce5d963843c49fea3ffa27333e75c59a7d86a5094f9
Change "firefox-stub" in ?product= to be "test-stub" and now hit Enter/Return
The downloaded build's filename should now be "test-stub.exe"
Install it
You can either click "
import hashlib
import hmac
import os
from time import time
from urllib.parse import quote_plus
from uuid import uuid4
from molotov import scenario
Started by user Stephen Donner
[EnvInject] - Loading node environment variables.
Building remotely on CL7-DOCKER-B in workspace /home/jenkins/workspace/go-bouncer.dev
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/mozilla-services/go-bouncer.git # timeout=10
Fetching upstream changes from https://github.com/mozilla-services/go-bouncer.git
> git --version # timeout=10
> git fetch --tags --progress https://github.com/mozilla-services/go-bouncer.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse origin/pyup-update-requests-2.12.4-to-2.13.0^{commit} # timeout=10
Started by user Stephen Donner
[EnvInject] - Loading node environment variables.
Building remotely on CL7-DOCKER-B in workspace /home/jenkins/workspace/go-bouncer.dev
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/mozilla-services/go-bouncer.git # timeout=10
Fetching upstream changes from https://github.com/mozilla-services/go-bouncer.git
> git --version # timeout=10
> git fetch --tags --progress https://github.com/mozilla-services/go-bouncer.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse origin/pyup-update-pytest-3.0.5-to-3.0.6^{commit} # timeout=10
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GET https://stubattribution-default-cdn.stage.mozaws.net/builds/test-stub/en-US/win/61cc08c420cd312349bb20c068ef7cab572d85474c2c3afb724ed49e172748d2/test-stub.exe
Accept: */*
Accept-Encoding: gzip, deflate
Host: stubattribution-default-cdn.stage.mozaws.net
User-Agent: Python/3.5 aiohttp/1.2.0
Content-Length: 0ClientOSError(8, 'Cannot connect to host stubattribution-default-cdn.stage.mozaws.net:443 ssl:True [nodename nor servname provided, or not known]') File "/Users/sdonner/.pyenv/versions/3.5.0/envs/stubattribution-loadtests/lib/python3.5/site-packages/molotov/fmwk.py", line 81, in step
await func(session, *args_, **kw)
File "loadtest.py", line 37, in scenario_one
async with session.get(_SERVER, params=params) as resp: