mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
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
|
- 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,25 +50,27 @@ 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
|
||||||
- name: Create Parsers badge
|
coverage:
|
||||||
if: ${{ env.BRANCH_REF }} == 'ref/head/master'
|
runs-on: ubuntu-latest
|
||||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
if: ${{ github.ref == 'ref/head/master' }}
|
||||||
with:
|
steps:
|
||||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
- name: Create Parsers badge
|
||||||
gistID: ${{ secrets.GIST_BADGES_ID }}
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||||
filename: crowdsec_parsers_badge.json
|
with:
|
||||||
label: Hub Parsers
|
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||||
message: ${{ env.PARSERS_COV }}
|
gistID: ${{ secrets.GIST_BADGES_ID }}
|
||||||
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
filename: crowdsec_parsers_badge.json
|
||||||
- name: Create Scenarios badge
|
label: Hub Parsers
|
||||||
if: ${{ env.BRANCH_REF }} == 'ref/head/master'
|
message: ${{ env.PARSERS_COV }}
|
||||||
uses: schneegans/dynamic-badges-action@v1.1.0
|
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
||||||
with:
|
- name: Create Scenarios badge
|
||||||
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
||||||
gistID: ${{ secrets.GIST_BADGES_ID }}
|
with:
|
||||||
filename: crowdsec_scenarios_badge.json
|
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
||||||
label: Hub Scenarios
|
gistID: ${{ secrets.GIST_BADGES_ID }}
|
||||||
message: ${{ env.SCENARIOS_COV }}
|
filename: crowdsec_scenarios_badge.json
|
||||||
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
label: Hub Scenarios
|
||||||
|
message: ${{ env.SCENARIOS_COV }}
|
||||||
|
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue