Giter Site home page Giter Site logo

docker-unittests's Introduction

docker-unittests

Maven Javadocs License: MIT Commit activity

Build Status 0pdd Dependency Status Known Vulnerabilities

DevOps By Rultor.com EO badge We recommend IntelliJ IDEA

Qulice SQ passed SQ bugs SQ tech debt Codebeat Codacy Badge

SQ coverage Codecov

The main concept is that all tests should use the image as is without any 'internal' go-related features. We, like users, receive the image and we are going to check what we've got.

The project has been started in Java as POC, however, I'm thinking about porting to python which is more suitable lang for the Ansible-oriented stack. Kindly ask you to raise the issue in case of any suggestions regarding another ways\languages.

General image test

  1. Define an *.yml file with tests.
    version: 1
    
    tests:
      - test:
          assume: "java version is 1.9, Debian build"
          cmd:    "java -version"
          output:
            - contains: "openjdk version \"9.0.1\""
            - contains: "build 9.0.1+11-Debian-1"
    
      - test:
          assume: "curl version is 7.xxx"
          cmd:    "curl --version"
          output:
            - startsWith: "curl 7."
            - matches:    "^curl\\s7.*\\n.*\\nProtocols.+ftps.+https.+telnet.*\\n.*\\n$"
            - contains:   "AsynchDNS IDN IPv6 Largefile GSS-API"
  2. Run tests for image
     java -jar docker-unittests.jar -f image-tests.yml -i openjdk:9.0.1-11
    docker image tests results

Test image by shell script

  1. Define the test.yml with tests.
    version: 1
     
     tests:
     
       - test:
           assume: "java version is 1.9, Debian build"
           cmd:    "java -version"
           output:
             - contains: openjdk version "9.0.1"
             - contains: build 9.0.1+11-Debian
     
       # The test below will fail due to wrong version of curl.
       - test: 
           assume: "curl version is 8000"
           cmd:    "curl --version"
           output:
             - startsWith: "curl 8000"
             - matches:    "^curl\\s7.*\\n.*\\nProtocols.+ftps.+https.+telnet.*\\n.*\\n$"
             - contains:   "AsynchDNS IDN IPv6 Largefile GSS-API"
    
  2. Define an test.sh with testing command
     #!/usr/bin/env bash
     set -e
     echo Testing has been started
     java -jar docker-unittests.jar -f test.yml -i openjdk:9.0.1-11
     echo This line will not be executed as testing will fail
  3. Run the test.sh docker image tests results

F.A.Q.

docker-unittests's People

Contributors

dgroup avatar bodax 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.