Giter Site home page Giter Site logo

kata-containers / tests Goto Github PK

View Code? Open in Web Editor NEW
141.0 55.0 194.0 12.82 MB

Kata Containers tests, CI, and metrics

Home Page: https://katacontainers.io/

License: Apache License 2.0

Shell 79.70% Makefile 0.99% Go 13.56% Dockerfile 0.53% R 4.69% Smarty 0.07% Jupyter Notebook 0.10% Python 0.36%
kata-containers

tests's Issues

Enable tests for this repo

Currently, .travis.yml only runs the static tests on PRs raised for this repo.

As soon as possible, we need to add the following to .travis.yml (plus docker setup) so all PRs for this repo will trigger all tests to run:

script:
  - ".ci/go-test.sh"

Add developer variable for lenient linters

The static checks script currently only runs a subset of linters under the CI, but all linters by default otherwise.

Add a KATA_DEV_MODE variable that, if set, will run the same subset. This is useful and crucially does not require the developer to pretend to be running under a CI (which could be dangerous).

Provide ability to skip a test based on the runtime being used

Currently, some of the tests make use of Skip() (ginkgo). At some future point they will also be using skip (bats) too. These calls skip the tests unconditionally. However, we are likely to need ways to skip a test but only for particular runtime(s) [1]:

Something like:

if kata.Runtime("cc") {
    Skip("Issue: ...")
}

We should also support any:

if kata.Runtime("any") {
    Skip("Issue: ...")
}

... and maybe a regex like:

if kata.Runtime("cc|runv") {
    Skip("Issue: ...")
}

We'll need kata.Runtime(name string) to check to see which runtime the kata-runtime symlink actually points to. If the link name ends in -cc [2], it's a Clear Containers-based runtime, else runv.

We can then compare the fully resolved value of the Runtime path with the runtime type the test is requesting be skipped and return true/false as appropriate.


[1] - runtime names should be specified using the same syntax as used for the build. Namely cc or runv (or all). See kata-containers/runtime#16.
[2] - Or, run the runtime and check for a known string such as:

$ kata-runtime --help | grep -q clearcontainers

Add extra linters

Add the following golang linters to the static checks tool for more stringent checks:

  • staticcheck
  • structcheck
  • unused

Add a README

This repo needs a README.md to explain various things including KATA_DEV_MODE.

Add linters to static checks

https://github.com/kata-containers/tests/blob/master/.ci/static-checks.sh needs to call the various golang linters to sanity check the code submissions.

Currently, the only kata repo using linters is the throttler:

I plan to remove that file entirely and add it into https://github.com/kata-containers/tests/blob/master/.ci/static-checks.sh, so that it will be invoked for all the kata repos.

Does that sound good to you @sameo, @gnawux, @grahamwhaley?

Create central static checks test

Add a script that will be the single source of all static tests used to build components.

Initially, it will simply run checkcommits, but will be extended later to run linters, etc.

All other repos should invoke this script to avoid a proliferation of (different) static check scripts.

Don't call gometalinter unless the calling project contains go code

Currently, .ci/static-checks.sh unconditionally calls gometalinter. This is actually fine since gometalinter is clever enough to detect if there are any go packages to check and it will exit cleanly if not.

However, it's pointless installing gometalinter for those calling repositories that don't contain golang code, so add a check to speed up the CI in those scenarios.

Enable checkcommits

Enable checkcommits which will requires that all PRs have:

  • a Signed-off-by: line.
  • a Fixes #XXX comment where XXX is a github issue number.
  • Requires all commits to have a "sub-system" followed by a colon, followed by a brief description.
  • Requires a blank line after the subsystem.
  • Requires all commits to have a fuller description after the sub-system that will contain the Fixes ### and Signed-off-by: comments.

Add jenkins_job_build.sh script

jenkins_job_build.sh script should be called in the Jenkins Jobs for all repos. This will minimize duplicated code in the jenkins job configuration

Can we check that stdout/stderr produce correct output

Relating to kata-containers/agent#125 and kata-containers/agent#124 - can we add a test that checks that what we get over stdout and stderr are in fact correct and whole.
@jodh-intel has suggested https://github.com/jamesodhunt/utfout (oh, look, it is written by @jodh-intel ;-) ) might be a good tool to use for this.
Other simpler thoughts from me are to:

  • just check we get the right size we expect to start with
  • we could do an md5sum compare to what we expect

/cc @chavafg

CI: Ignore vendor/ directories when running go test

go list in golang 1.9 is clever and prunes vendor packages by default:

$ (GOROOT=/usr/local/go/go1.9/go PATH=$GOROOT/bin:$PATH go list ./...)
github.com/kata-containers/proxy

However, we're using golang 1.8 with Travis and the behaviour is different:

$ (GOROOT=/usr/local/go/go1.8.1/go PATH=$GOROOT/bin:$PATH go list ./...)
github.com/kata-containers/proxy
github.com/kata-containers/proxy/vendor/github.com/davecgh/go-spew/spew
github.com/kata-containers/proxy/vendor/github.com/hashicorp/yamux
github.com/kata-containers/proxy/vendor/github.com/pmezard/go-difflib/difflib
github.com/kata-containers/proxy/vendor/github.com/sirupsen/logrus
github.com/kata-containers/proxy/vendor/github.com/sirupsen/logrus/hooks/syslog
github.com/kata-containers/proxy/vendor/github.com/stretchr/testify/assert
github.com/kata-containers/proxy/vendor/golang.org/x/crypto/ssh
github.com/kata-containers/proxy/vendor/golang.org/x/crypto/ssh/terminal
github.com/kata-containers/proxy/vendor/golang.org/x/sys/unix
github.com/kata-containers/proxy/vendor/golang.org/x/sys/windows

This behaviour is causing .ci/go-test.sh to try to run tests on vendor packages, which we don't want.

We could update all the .travis.yml files to only use versions of go >= 1.9 but we specify go 1.8 as our minimum version. Hence, simply filter vendor packages out of go list before running go test.

Add a log parsing tool

Create a tool that can manipulate the structured logs the system components generate.

Initially the tool should be capable of accepting any number of log files which will then be:

  • Parsed, sorted by timestamp and displayed (in a variety of formats) along with time deltas (showing the time between log calls).
  • Checked for bogus/invalid log entries (or bogus/invalid log data).

Along with the above, I plan to add a check at the end of a CI run which will call this tool. If the tool fails, the PR will be failed. The rationale here being that all component logs should:

  • encode a common set of fields.
  • always be fully machine parseable.

Replaces: clearcontainers/tests#590

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.