add functionnal test for hubtest (#996)
* add hubtest in functionnal test
This commit is contained in:
parent
de87d0d951
commit
37eedce72e
3 changed files with 36 additions and 24 deletions
46
.github/workflows/ci_hubtest.yml
vendored
46
.github/workflows/ci_hubtest.yml
vendored
|
@ -9,11 +9,9 @@ on:
|
|||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
hubtest:
|
||||
name: Hub tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BRANCH_REF: ${{ github.ref }}
|
||||
steps:
|
||||
- name: Set up Go 1.16
|
||||
uses: actions/setup-go@v1
|
||||
|
@ -52,25 +50,27 @@ jobs:
|
|||
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 "SCENARIO_BADGE_COLOR=$(if [ $SCENARIOS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
|
||||
- name: Create Parsers badge
|
||||
if: ${{ env.BRANCH_REF }} == 'ref/head/master'
|
||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||
with:
|
||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||
gistID: ${{ secrets.GIST_BADGES_ID }}
|
||||
filename: crowdsec_parsers_badge.json
|
||||
label: Hub Parsers
|
||||
message: ${{ env.PARSERS_COV }}
|
||||
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
||||
- name: Create Scenarios badge
|
||||
if: ${{ env.BRANCH_REF }} == 'ref/head/master'
|
||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||
with:
|
||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||
gistID: ${{ secrets.GIST_BADGES_ID }}
|
||||
filename: crowdsec_scenarios_badge.json
|
||||
label: Hub Scenarios
|
||||
message: ${{ env.SCENARIOS_COV }}
|
||||
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.ref == 'ref/head/master' }}
|
||||
steps:
|
||||
- name: Create Parsers badge
|
||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||
with:
|
||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||
gistID: ${{ secrets.GIST_BADGES_ID }}
|
||||
filename: crowdsec_parsers_badge.json
|
||||
label: Hub Parsers
|
||||
message: ${{ env.PARSERS_COV }}
|
||||
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
||||
- name: Create Scenarios badge
|
||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||
with:
|
||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||
gistID: ${{ secrets.GIST_BADGES_ID }}
|
||||
filename: crowdsec_scenarios_badge.json
|
||||
label: Hub Scenarios
|
||||
message: ${{ env.SCENARIOS_COV }}
|
||||
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ func NewHubTestCmd() *cobra.Command {
|
|||
Short: "create [test_name]",
|
||||
Example: `cscli hubtest create my-awesome-test --type syslog
|
||||
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),
|
||||
DisableAutoGenTag: true,
|
||||
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…
Add table
Reference in a new issue