add functionnal test for hubtest (#996)
* add hubtest in functionnal test
This commit is contained in:
parent
de87d0d951
commit
37eedce72e
10
.github/workflows/ci_hubtest.yml
vendored
10
.github/workflows/ci_hubtest.yml
vendored
|
@ -9,11 +9,9 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
hubtest:
|
||||||
name: Hub tests
|
name: Hub tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
BRANCH_REF: ${{ github.ref }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.16
|
- name: Set up Go 1.16
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
|
@ -52,8 +50,11 @@ jobs:
|
||||||
echo "SCENARIOS_COV_NUMBER=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2 | tr -d '%')"
|
echo "SCENARIOS_COV_NUMBER=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2 | tr -d '%')"
|
||||||
echo "PARSER_BADGE_COLOR=$(if [ $PARSERS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
|
echo "PARSER_BADGE_COLOR=$(if [ $PARSERS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
|
||||||
echo "SCENARIO_BADGE_COLOR=$(if [ $SCENARIOS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
|
echo "SCENARIO_BADGE_COLOR=$(if [ $SCENARIOS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
|
||||||
|
coverage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.ref == 'ref/head/master' }}
|
||||||
|
steps:
|
||||||
- name: Create Parsers badge
|
- name: Create Parsers badge
|
||||||
if: ${{ env.BRANCH_REF }} == 'ref/head/master'
|
|
||||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||||
|
@ -63,7 +64,6 @@ jobs:
|
||||||
message: ${{ env.PARSERS_COV }}
|
message: ${{ env.PARSERS_COV }}
|
||||||
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
||||||
- name: Create Scenarios badge
|
- name: Create Scenarios badge
|
||||||
if: ${{ env.BRANCH_REF }} == 'ref/head/master'
|
|
||||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||||
|
|
|
@ -58,7 +58,7 @@ func NewHubTestCmd() *cobra.Command {
|
||||||
Short: "create [test_name]",
|
Short: "create [test_name]",
|
||||||
Example: `cscli hubtest create my-awesome-test --type syslog
|
Example: `cscli hubtest create my-awesome-test --type syslog
|
||||||
cscli hubtest create my-nginx-custom-test --type nginx
|
cscli hubtest create my-nginx-custom-test --type nginx
|
||||||
cscli hubtest create my-scenario-test --parser crowdsecurity/nginx --scenario crowdsecurity/http-probing`,
|
cscli hubtest create my-scenario-test --parsers crowdsecurity/nginx --scenarios crowdsecurity/http-probing`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
DisableAutoGenTag: true,
|
DisableAutoGenTag: true,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
12
scripts/func_tests/tests_post-install_6hubtests.sh
Executable file
12
scripts/func_tests/tests_post-install_6hubtests.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
source tests_base.sh
|
||||||
|
|
||||||
|
CURRENT_DIR=$(pwd)
|
||||||
|
|
||||||
|
git clone https://github.com/crowdsecurity/hub.git
|
||||||
|
cd hub/
|
||||||
|
${CSCLI} hubtest run --all
|
||||||
|
|
||||||
|
cd "${CURRENT_DIR}"
|
Loading…
Reference in a new issue