Git Product home page Git Product logo

cruzillian / the-power Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gm3dmo/the-power

1.0 0.0 0.0 2.74 MB

The Power is a bunch of test scripts that share a single centralized configuration file for use with GitHub API's. It's commonly used by folks with a need to teach, learn, debug against GItHub's API's in a rapid fashion.

License: GNU General Public License v3.0

Shell 63.38% Ruby 0.33% Python 11.43% Perl 24.86%

the-power's Introduction

The Power

the-power

Table of Contents

  1. What is the Power?
  2. Setup Instructions
  3. Contributing to The Power
  4. Known Issues/Problems/Solutions
  5. Testcases
  6. Setting up a GitHub App to use with The Power
  7. GitHub API Learning Resources

What is The Power?

The Power is a simple test framework for GitHub's API's. It's goal is to help you learn to interact with and understand GitHub API's by building test scenarios such as; a repository with a pull request, teams and users on a testing instance of GitHub Enterprise or GitHub.com a pre-existing Organization and Enterprise Account.

The Power can create the following on a blank appliance or organization in <=30 seconds:

There are many other features and test-cases you can use or adapt to build scenarios of your own.

The Power is a tool for learning

  • Designed to be as simple as possible to understand. To keep things simple we exclusively uses only curl and jq to complete most tasks. Only a few of the more complex scenarios have other dependencies.

The Power is vast and deep

There are hundreds of pre-baked scripts to:

  • Create commits, secrets, hooks, issue comments, environments.
  • Bulk up your appliance by creating hundreds or thousands of users/orgs/repos/teams/pull requests.
  • Set up a Tiny GitHub App in less than 1 minute.
  • Demonstrate GitHub Actions.
  • Demonstrate Code scanning.

The Power is highly configurable

The configuration file .gh-api.examples.conf is the green fuse that drives The Power. The configuration file format is a simple list of key value pairs:

### [Branches](https://docs.github.com/en/rest/commits/commits)
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/
proposing-changes-to-your-work-with-pull-requests/about-branches
branch_name="new_branch"
protected_branch_name="main"
required_approving_reviewers=1
required_status_check_name="ci-test/this-check-is-required"
enforce_admins="false"
base_branch=main

The Power's configuration can be shared with other tools

The use of kv pairs in .gh-api-examples.conf provides maximum flexibility and simplicity. It allows the configuration file to provide the basic descriptors for other more advanced tools like Apache JMeter or hurl

Hurl using the .gh-api-examples.conf file

hurl-repo-characteristics.sh shows hurl provisioned with values .gh-api-examples.conf:

hurl --test --variables-file .gh-api-examples.conf --json hurl-tests/repo-characteristics.hurl | jq -r

The hurl-tests/repo-characteristics file looks like:

GET {{ GITHUB_API_BASE_URL }}/repos/{{ org }}/{{ repo }}
Accept: application/vnd.github.v3+json
Authorization: token {{ GITHUB_TOKEN }}

HTTP/2 200

[Asserts]
status >= 200
status < 300
header "Content-Type" == "application/json; charset=utf-8"
header "x-github-request-id" isString
jsonpath "$.name" == "{{ repo }}"
jsonpath "$.full_name" == "{{ org}}/{{ repo }}"

Why The Power

There are lots of great tools like Postman, JMeter for interacting with API's and building testsuites and many of the latest API's come with their own interactive documentation built-in like the swagger petstore. The Power is a solution for times and places where those tools just aren't available.

the-power's People

Contributors

gm3dmo avatar sn2b avatar kurgol avatar mcfluffinstein avatar kyanny avatar voxsteel avatar urubos avatar corycalahan avatar jimmybish avatar loujr avatar lumaxis avatar robertnorrie avatar wilsonwong1990 avatar mokshadharma avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.