Git Product home page Git Product logo

env-tests-logging's Introduction

Logging Environment Tests

This repo was designed to be run as a submodule of the GCP Logging repositories. It contains common tests to ensure behavioral consistency across languages and GCP platforms.

Usage

These tests were implemented in pytest triggered by nox

Run the full suite of tests:

nox -s tests

Run a specific test:

nox --session "tests(language='python', platform='cloudrun')"

By default, each test will tear down and re-create the GCP environment to ensure a clean environment. To re-use an existing environment while debugging, set the NO_CLEAN flag before running tests:

export NO_CLEAN=true

To allow parallel runs, envctl appends an id to each deployed resource. By default, this will be the runner's hostname, but it can be customized by setting ENVCTL_ID

Architecture

deployable/

The Deployable is a frankenstein-like package of code that can be deployed to any supported GCP environment. It contains a pub/sub listener, and a set of snippets that can be triggered by pub/sub messages. In this way, it allows us to trigger the same code in every GCP environment for consistency checks.

envctl/

envctl is a command line tool that allows us to spin up and down deployments in an automated way. It should accept three arguments: a language, a GCP environment name, and an action. envctl can be used to spin up and down test environments in a simple, reproducible way.

Implementation code for each language/environment pair can be found in envctl/env_scripts

envctl exposes the following sub-commands:

  • envctl <language> <environment> deploy
    • deploys a fresh environment
  • envctl <language> <environment> verify
    • verifies that an environment is up (returns true/false)
  • envctl <language> <environment> destroy
    • destroys an existing environment
  • envctl <language> <environment> trigger <snippet> <optional arguments>
    • sends a pub/sub message to trigger a snippet in an environment
    • optional arguments are embedded as custom attributes in Pub/Sub messages
  • envctl <language> <environment> filter-string
    • returns a filter that finds logs created by the environment
  • envctl <language> <environment> logs
    • returns a list of recent logs from the environment

tests/

Contains the pytest code that tests each environment. Common logic is stored as abstract super-classes in tests/common. Concrete implementations for each environment can be found in tests/<language>/test_<environment>.py. Test files in tests/<language> can inherit from any file in tests/common logic as needed, in order to share test logic between environments.

Shared Tests

Test Name Optional Input Description
simplelog log_name, log_text Logs a simple text payload

env-tests-logging's People

Contributors

0xsage avatar arbrown avatar daniel-sanche avatar google-cloud-policy-bot[bot] avatar justinbeckwith avatar minherz avatar parthea avatar renovate-bot 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.