Skip to content

Instantly share code, notes, and snippets.

View mariusmitrofan's full-sized avatar

Marius Mitrofan mariusmitrofan

View GitHub Profile
@mariusmitrofan
mariusmitrofan / gist:d661923d6a0964daa4f9e61029f331b0
Created November 19, 2020 22:00
Create project automatically - sentry 20
# Bootstrap the Sentry environment
from sentry.utils.runner import configure
configure()
from sentry.models import Team, Project, User, ProjectKey
def get_user(a_user):
for user in User.objects.all():
if user.get_username() == a_user:
return user
@mariusmitrofan
mariusmitrofan / test_file.json
Last active May 24, 2020 12:31
JSON-ECommerceExample
{
"test_name": "Add to cart workflow",
"num_clients": 250,
"hatch_rate": 250,
"run_time": 60,
"domain_name": "my-magento-website.com",
"protocol": "https",
"test_region": [
"us-east-1"
],
@mariusmitrofan
mariusmitrofan / services.md
Created February 16, 2020 19:24
services

Authentication:

  • AWS Cognito
  • AWS Cognito Hosted UI

API Authorization and Throttling:

  • AWS API Gateway with Cognito Authorizer
  • AWS API Gateway with API Keys

Backend execution:

  • AWS Lambda
@mariusmitrofan
mariusmitrofan / gist:959536736df18743479a7c03566c69d1
Created January 30, 2020 13:16
Paddle Webhook Check for Python 3.7 in AWS Lambda behind AWS API Gateway
import collections
import base64
import json
import urllib.parse
# Crypto can be found at https://pypi.org/project/pycryptodome/
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA1
from Crypto.Signature import PKCS1_v1_5
import phpserialize
image: "alpine:3.10"
stages:
- load_test
variables:
API_KEY: your_api_key
TIMEOUT: 40
before_script:
#!groovy
def timeout=40
def API_KEY=your_api_key_here
pipeline {
agent any
stages {
stage('StartLoadTest') {
export API_KEY=the api key you received in your mailbox
export REQUEST=the value that was generated when you
created the test and offered in the response as
"requestId"
cat > results-from-bombard.json <<EOF
{
"requestId": "${REQUEST}"
}
EOF
export API_KEY=the api key you received in your mailbox
cat > bombard.json <<EOF
{
"numClients": 500000,
"hatchRate": 500000,
"runTime": 300,
"maxThreads": 10,
"hostname": "netbears.com",
"protocol": "https",
* status:
-> Can be "COMPLETED" or "IN PROGRESS",
depending on whether test is still running or not
-> If you submit a request with an invalid "requestId",
you will get an "IN PROGRESS" reply
* input:
-> These are all the parameters that you have used to generate the load test
* globalStats:
<MANDATORY PARAMETERS>
* numClients:
-> The number of users testing your application
-> Each user opens a TCP connection to your application and tests it
* hatchRate:
-> How many users will be added to the current users, per second,
until the total amount of users is fulfilled.
-> This tells the app how gradually do you want to do the load test