Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
|
8ef194b49b | ||
|
382073db78 | ||
|
e8d89d6a42 |
35 changed files with 145 additions and 165 deletions
6
.github/workflows/docker-tests.yml
vendored
6
.github/workflows/docker-tests.yml
vendored
|
@ -85,7 +85,6 @@ jobs:
|
||||||
|
|
||||||
- name: "Install pipenv"
|
- name: "Install pipenv"
|
||||||
run: |
|
run: |
|
||||||
cd docker/test
|
|
||||||
python -m pip install --upgrade pipenv wheel
|
python -m pip install --upgrade pipenv wheel
|
||||||
|
|
||||||
- name: "Cache virtualenvs"
|
- name: "Cache virtualenvs"
|
||||||
|
@ -98,7 +97,6 @@ jobs:
|
||||||
- name: "Install dependencies"
|
- name: "Install dependencies"
|
||||||
if: steps.cache-pipenv.outputs.cache-hit != 'true'
|
if: steps.cache-pipenv.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
cd docker/test
|
|
||||||
pipenv install --deploy
|
pipenv install --deploy
|
||||||
|
|
||||||
- name: "Create Docker network"
|
- name: "Create Docker network"
|
||||||
|
@ -110,6 +108,6 @@ jobs:
|
||||||
CROWDSEC_TEST_FLAVORS: slim,debian
|
CROWDSEC_TEST_FLAVORS: slim,debian
|
||||||
CROWDSEC_TEST_NETWORK: net-test
|
CROWDSEC_TEST_NETWORK: net-test
|
||||||
CROWDSEC_TEST_TIMEOUT: 90
|
CROWDSEC_TEST_TIMEOUT: 90
|
||||||
|
PYTEST_ADDOPTS: --durations=0 -vv --color=yes
|
||||||
run: |
|
run: |
|
||||||
cd docker/test
|
pipenv run pytest -n 1
|
||||||
pipenv run pytest -n 2 --durations=0 --color=yes
|
|
||||||
|
|
52
.github/workflows/tests_deb.yml
vendored
Normal file
52
.github/workflows/tests_deb.yml
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
name: Test .deb packaging
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: "Test .deb packages"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: 1.20.3
|
||||||
|
|
||||||
|
- name: Cache virtualenvs
|
||||||
|
id: cache-pipenv
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.local/share/virtualenvs
|
||||||
|
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
|
||||||
|
|
||||||
|
- name: Install functional test dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt install -y build-essential debhelper devscripts fakeroot lintian
|
||||||
|
docker network create net-test
|
||||||
|
python3 -m pip install --upgrade pipenv wheel
|
||||||
|
cd docker/test
|
||||||
|
pipenv install --deploy
|
||||||
|
|
||||||
|
- name: Run functional tests
|
||||||
|
env:
|
||||||
|
CROWDSEC_TEST_VERSION: dev
|
||||||
|
CROWDSEC_TEST_FLAVORS: full
|
||||||
|
CROWDSEC_TEST_NETWORK: net-test
|
||||||
|
CROWDSEC_TEST_TIMEOUT: 60
|
||||||
|
PYTEST_ADDOPTS: --durations=0 -vv --color=yes
|
||||||
|
run: |
|
||||||
|
pipenv run pytest -m deb
|
17
Makefile
17
Makefile
|
@ -63,8 +63,17 @@ all: clean test build
|
||||||
.PHONY: plugins
|
.PHONY: plugins
|
||||||
plugins: http-plugin slack-plugin splunk-plugin email-plugin dummy-plugin
|
plugins: http-plugin slack-plugin splunk-plugin email-plugin dummy-plugin
|
||||||
|
|
||||||
|
# same as "$(MAKE) -f debian/rules clean" but without the dependency on debhelper
|
||||||
|
.PHONY: clean-debian
|
||||||
|
clean-debian:
|
||||||
|
@$(RM) -r debian/crowdsec
|
||||||
|
@$(RM) -r debian/files
|
||||||
|
@$(RM) -r debian/.debhelper
|
||||||
|
@$(RM) -r debian/*.substvars
|
||||||
|
@$(RM) -r debian/*-stamp
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: testclean
|
clean: clean-test
|
||||||
@$(MAKE) -C $(CROWDSEC_FOLDER) clean --no-print-directory RM="$(RM)" WIN_IGNORE_ERR="$(WIN_IGNORE_ERR)" CP="$(CP)" CPR="$(CPR)" MKDIR="$(MKDIR)"
|
@$(MAKE) -C $(CROWDSEC_FOLDER) clean --no-print-directory RM="$(RM)" WIN_IGNORE_ERR="$(WIN_IGNORE_ERR)" CP="$(CP)" CPR="$(CPR)" MKDIR="$(MKDIR)"
|
||||||
@$(MAKE) -C $(CSCLI_FOLDER) clean --no-print-directory RM="$(RM)" WIN_IGNORE_ERR="$(WIN_IGNORE_ERR)" CP="$(CP)" CPR="$(CPR)" MKDIR="$(MKDIR)"
|
@$(MAKE) -C $(CSCLI_FOLDER) clean --no-print-directory RM="$(RM)" WIN_IGNORE_ERR="$(WIN_IGNORE_ERR)" CP="$(CP)" CPR="$(CPR)" MKDIR="$(MKDIR)"
|
||||||
@$(RM) $(CROWDSEC_BIN) $(WIN_IGNORE_ERR)
|
@$(RM) $(CROWDSEC_BIN) $(WIN_IGNORE_ERR)
|
||||||
|
@ -99,8 +108,8 @@ email-plugin: goversion
|
||||||
dummy-plugin: goversion
|
dummy-plugin: goversion
|
||||||
$(MAKE) -C $(DUMMY_PLUGIN_FOLDER) build --no-print-directory GOARCH=$(GOARCH) GOOS=$(GOOS) RM="$(RM)" WIN_IGNORE_ERR="$(WIN_IGNORE_ERR)" CP="$(CP)" CPR="$(CPR)" MKDIR="$(MKDIR)"
|
$(MAKE) -C $(DUMMY_PLUGIN_FOLDER) build --no-print-directory GOARCH=$(GOARCH) GOOS=$(GOOS) RM="$(RM)" WIN_IGNORE_ERR="$(WIN_IGNORE_ERR)" CP="$(CP)" CPR="$(CPR)" MKDIR="$(MKDIR)"
|
||||||
|
|
||||||
.PHONY: testclean
|
.PHONY: clean-test
|
||||||
testclean: bats-clean
|
clean-test: bats-clean
|
||||||
@$(RM) pkg/apiserver/ent $(WIN_IGNORE_ERR)
|
@$(RM) pkg/apiserver/ent $(WIN_IGNORE_ERR)
|
||||||
@$(RM) pkg/cwhub/hubdir $(WIN_IGNORE_ERR)
|
@$(RM) pkg/cwhub/hubdir $(WIN_IGNORE_ERR)
|
||||||
@$(RM) pkg/cwhub/install $(WIN_IGNORE_ERR)
|
@$(RM) pkg/cwhub/install $(WIN_IGNORE_ERR)
|
||||||
|
@ -124,7 +133,7 @@ go-acc: testenv goversion
|
||||||
|
|
||||||
.PHONY: localstack
|
.PHONY: localstack
|
||||||
localstack:
|
localstack:
|
||||||
docker-compose -f test/localstack/docker-compose.yml up
|
docker-compose -f testdata/localstack/docker-compose.yml up
|
||||||
|
|
||||||
.PHONY: localstack-stop
|
.PHONY: localstack-stop
|
||||||
localstack-stop:
|
localstack-stop:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[packages]
|
[packages]
|
||||||
pytest-dotenv = "*"
|
pytest-dotenv = "*"
|
||||||
pytest-xdist = "*"
|
pytest-xdist = "*"
|
||||||
pytest-cs = {ref = "0.4.0", git = "https://github.com/crowdsecurity/pytest-cs.git"}
|
pytest-cs = {ref = "0.7.2", git = "https://github.com/crowdsecurity/pytest-cs.git"}
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
gnureadline = "*"
|
gnureadline = "*"
|
112
docker/test/Pipfile.lock → Pipfile.lock
generated
112
docker/test/Pipfile.lock → Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "da2959f993eb751a5f6d2b1c4537ba39ed414d0e9d300dc513ced5a8f0ab4261"
|
"sha256": "77eb85b7741bd7b7bd56d513eb215b56b9fc05d9cf7310303d84a4d813f15266"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -16,14 +16,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
"attrs": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836",
|
|
||||||
"sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"
|
|
||||||
],
|
|
||||||
"markers": "python_version >= '3.6'",
|
|
||||||
"version": "==22.2.0"
|
|
||||||
},
|
|
||||||
"certifi": {
|
"certifi": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
|
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
|
||||||
|
@ -184,32 +176,28 @@
|
||||||
},
|
},
|
||||||
"cryptography": {
|
"cryptography": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:103e8f7155f3ce2ffa0049fe60169878d47a4364b277906386f8de21c9234aa1",
|
"sha256:05dc219433b14046c476f6f09d7636b92a1c3e5808b9a6536adf4932b3b2c440",
|
||||||
"sha256:23df8ca3f24699167daf3e23e51f7ba7334d504af63a94af468f468b975b7dd7",
|
"sha256:0dcca15d3a19a66e63662dc8d30f8036b07be851a8680eda92d079868f106288",
|
||||||
"sha256:2725672bb53bb92dc7b4150d233cd4b8c59615cd8288d495eaa86db00d4e5c06",
|
"sha256:142bae539ef28a1c76794cca7f49729e7c54423f615cfd9b0b1fa90ebe53244b",
|
||||||
"sha256:30b1d1bfd00f6fc80d11300a29f1d8ab2b8d9febb6ed4a38a76880ec564fae84",
|
"sha256:3daf9b114213f8ba460b829a02896789751626a2a4e7a43a28ee77c04b5e4958",
|
||||||
"sha256:35d658536b0a4117c885728d1a7032bdc9a5974722ae298d6c533755a6ee3915",
|
"sha256:48f388d0d153350f378c7f7b41497a54ff1513c816bcbbcafe5b829e59b9ce5b",
|
||||||
"sha256:50cadb9b2f961757e712a9737ef33d89b8190c3ea34d0fb6675e00edbe35d074",
|
"sha256:4df2af28d7bedc84fe45bd49bc35d710aede676e2a4cb7fc6d103a2adc8afe4d",
|
||||||
"sha256:5f8c682e736513db7d04349b4f6693690170f95aac449c56f97415c6980edef5",
|
"sha256:4f01c9863da784558165f5d4d916093737a75203a5c5286fde60e503e4276c7a",
|
||||||
"sha256:6236a9610c912b129610eb1a274bdc1350b5df834d124fa84729ebeaf7da42c3",
|
"sha256:7a38250f433cd41df7fcb763caa3ee9362777fdb4dc642b9a349721d2bf47404",
|
||||||
"sha256:788b3921d763ee35dfdb04248d0e3de11e3ca8eb22e2e48fef880c42e1f3c8f9",
|
"sha256:8f79b5ff5ad9d3218afb1e7e20ea74da5f76943ee5edb7f76e56ec5161ec782b",
|
||||||
"sha256:8bc0008ef798231fac03fe7d26e82d601d15bd16f3afaad1c6113771566570f3",
|
"sha256:956ba8701b4ffe91ba59665ed170a2ebbdc6fc0e40de5f6059195d9f2b33ca0e",
|
||||||
"sha256:8f35c17bd4faed2bc7797d2a66cbb4f986242ce2e30340ab832e5d99ae60e011",
|
"sha256:a04386fb7bc85fab9cd51b6308633a3c271e3d0d3eae917eebab2fac6219b6d2",
|
||||||
"sha256:b49a88ff802e1993b7f749b1eeb31134f03c8d5c956e3c125c75558955cda536",
|
"sha256:a95f4802d49faa6a674242e25bfeea6fc2acd915b5e5e29ac90a32b1139cae1c",
|
||||||
"sha256:bc0521cce2c1d541634b19f3ac661d7a64f9555135e9d8af3980965be717fd4a",
|
"sha256:adc0d980fd2760c9e5de537c28935cc32b9353baaf28e0814df417619c6c8c3b",
|
||||||
"sha256:bc5b871e977c8ee5a1bbc42fa8d19bcc08baf0c51cbf1586b0e87a2694dde42f",
|
"sha256:aecbb1592b0188e030cb01f82d12556cf72e218280f621deed7d806afd2113f9",
|
||||||
"sha256:c43ac224aabcbf83a947eeb8b17eaf1547bce3767ee2d70093b461f31729a480",
|
"sha256:b12794f01d4cacfbd3177b9042198f3af1c856eedd0a98f10f141385c809a14b",
|
||||||
"sha256:d15809e0dbdad486f4ad0979753518f47980020b7a34e9fc56e8be4f60702fac",
|
"sha256:c0764e72b36a3dc065c155e5b22f93df465da9c39af65516fe04ed3c68c92636",
|
||||||
"sha256:d7d84a512a59f4412ca8549b01f94be4161c94efc598bf09d027d67826beddc0",
|
"sha256:c33c0d32b8594fa647d2e01dbccc303478e16fdd7cf98652d5b3ed11aa5e5c99",
|
||||||
"sha256:e029b844c21116564b8b61216befabca4b500e6816fa9f0ba49527653cae2108",
|
"sha256:cbaba590180cba88cb99a5f76f90808a624f18b169b90a4abb40c1fd8c19420e",
|
||||||
"sha256:e8a0772016feeb106efd28d4a328e77dc2edae84dfbac06061319fdb669ff828",
|
"sha256:d5a1bd0e9e2031465761dfa920c16b0065ad77321d8a8c1f5ee331021fda65e9"
|
||||||
"sha256:e944fe07b6f229f4c1a06a7ef906a19652bdd9fd54c761b0ff87e83ae7a30354",
|
|
||||||
"sha256:eb40fe69cfc6f5cdab9a5ebd022131ba21453cf7b8a7fd3631f45bbf52bed612",
|
|
||||||
"sha256:fa507318e427169ade4e9eccef39e9011cdc19534f55ca2f36ec3f388c1f70f3",
|
|
||||||
"sha256:ffd394c7896ed7821a6d13b24657c6a34b6e2650bd84ae063cf11ccffa4f1a97"
|
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.6'",
|
"markers": "python_version >= '3.6'",
|
||||||
"version": "==39.0.2"
|
"version": "==40.0.2"
|
||||||
},
|
},
|
||||||
"docker": {
|
"docker": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -253,11 +241,11 @@
|
||||||
},
|
},
|
||||||
"packaging": {
|
"packaging": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2",
|
"sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61",
|
||||||
"sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"
|
"sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.7'",
|
"markers": "python_version >= '3.7'",
|
||||||
"version": "==23.0"
|
"version": "==23.1"
|
||||||
},
|
},
|
||||||
"pluggy": {
|
"pluggy": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -269,23 +257,23 @@
|
||||||
},
|
},
|
||||||
"psutil": {
|
"psutil": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:149555f59a69b33f056ba1c4eb22bb7bf24332ce631c44a319cec09f876aaeff",
|
"sha256:104a5cc0e31baa2bcf67900be36acde157756b9c44017b86b2c049f11957887d",
|
||||||
"sha256:16653106f3b59386ffe10e0bad3bb6299e169d5327d3f187614b1cb8f24cf2e1",
|
"sha256:3c6f686f4225553615612f6d9bc21f1c0e305f75d7d8454f9b46e901778e7217",
|
||||||
"sha256:3d7f9739eb435d4b1338944abe23f49584bde5395f27487d2ee25ad9a8774a62",
|
"sha256:4aef137f3345082a3d3232187aeb4ac4ef959ba3d7c10c33dd73763fbc063da4",
|
||||||
"sha256:3ff89f9b835100a825b14c2808a106b6fdcc4b15483141482a12c725e7f78549",
|
"sha256:5410638e4df39c54d957fc51ce03048acd8e6d60abc0f5107af51e5fb566eb3c",
|
||||||
"sha256:54c0d3d8e0078b7666984e11b12b88af2db11d11249a8ac8920dd5ef68a66e08",
|
"sha256:5b9b8cb93f507e8dbaf22af6a2fd0ccbe8244bf30b1baad6b3954e935157ae3f",
|
||||||
"sha256:54d5b184728298f2ca8567bf83c422b706200bcbbfafdc06718264f9393cfeb7",
|
"sha256:7a7dd9997128a0d928ed4fb2c2d57e5102bb6089027939f3b722f3a210f9a8da",
|
||||||
"sha256:6001c809253a29599bc0dfd5179d9f8a5779f9dffea1da0f13c53ee568115e1e",
|
"sha256:89518112647f1276b03ca97b65cc7f64ca587b1eb0278383017c2a0dcc26cbe4",
|
||||||
"sha256:68908971daf802203f3d37e78d3f8831b6d1014864d7a85937941bb35f09aefe",
|
"sha256:8c5f7c5a052d1d567db4ddd231a9d27a74e8e4a9c3f44b1032762bd7b9fdcd42",
|
||||||
"sha256:6b92c532979bafc2df23ddc785ed116fced1f492ad90a6830cf24f4d1ea27d24",
|
"sha256:ab8ed1a1d77c95453db1ae00a3f9c50227ebd955437bcf2a574ba8adbf6a74d5",
|
||||||
"sha256:852dd5d9f8a47169fe62fd4a971aa07859476c2ba22c2254d4a1baa4e10b95ad",
|
"sha256:acf2aef9391710afded549ff602b5887d7a2349831ae4c26be7c807c0a39fac4",
|
||||||
"sha256:9120cd39dca5c5e1c54b59a41d205023d436799b1c8c4d3ff71af18535728e94",
|
"sha256:b258c0c1c9d145a1d5ceffab1134441c4c5113b2417fafff7315a917a026c3c9",
|
||||||
"sha256:c1ca331af862803a42677c120aff8a814a804e09832f166f226bfd22b56feee8",
|
"sha256:be8929ce4313f9f8146caad4272f6abb8bf99fc6cf59344a3167ecd74f4f203f",
|
||||||
"sha256:efeae04f9516907be44904cc7ce08defb6b665128992a56957abc9b61dca94b7",
|
"sha256:c607bb3b57dc779d55e1554846352b4e358c10fff3abf3514a7a6601beebdb30",
|
||||||
"sha256:fd8522436a6ada7b4aad6638662966de0d61d241cb821239b2ae7013d41a43d4"
|
"sha256:ea8518d152174e1249c4f2a1c89e3e6065941df2fa13a1ab45327716a23c2b48"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||||
"version": "==5.9.4"
|
"version": "==5.9.5"
|
||||||
},
|
},
|
||||||
"pycparser": {
|
"pycparser": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -296,15 +284,15 @@
|
||||||
},
|
},
|
||||||
"pytest": {
|
"pytest": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e",
|
"sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362",
|
||||||
"sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4"
|
"sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.7'",
|
"markers": "python_version >= '3.7'",
|
||||||
"version": "==7.2.2"
|
"version": "==7.3.1"
|
||||||
},
|
},
|
||||||
"pytest-cs": {
|
"pytest-cs": {
|
||||||
"git": "https://github.com/crowdsecurity/pytest-cs.git",
|
"git": "https://github.com/crowdsecurity/pytest-cs.git",
|
||||||
"ref": "8c49bd8072672c49855a7991a5900858b3ebb777"
|
"ref": "df280cac5617c9c187f56d04b8df7d736aa6323a"
|
||||||
},
|
},
|
||||||
"pytest-datadir": {
|
"pytest-datadir": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -497,11 +485,11 @@
|
||||||
},
|
},
|
||||||
"ipython": {
|
"ipython": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:5b54478e459155a326bf5f42ee4f29df76258c0279c36f21d71ddb560f88b156",
|
"sha256:1c183bf61b148b00bcebfa5d9b39312733ae97f6dad90d7e9b4d86c8647f498c",
|
||||||
"sha256:735cede4099dbc903ee540307b9171fbfef4aa75cfcacc5a273b2cda2f02be04"
|
"sha256:a950236df04ad75b5bc7f816f9af3d74dc118fd42f2ff7e80e8e60ca1f182e2d"
|
||||||
],
|
],
|
||||||
"markers": "python_version < '3.11' and python_version >= '3.7'",
|
"markers": "python_version < '3.11' and python_version >= '3.7'",
|
||||||
"version": "==8.11.0"
|
"version": "==8.12.0"
|
||||||
},
|
},
|
||||||
"jedi": {
|
"jedi": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -566,11 +554,11 @@
|
||||||
},
|
},
|
||||||
"pygments": {
|
"pygments": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:b3ed06a9e8ac9a9aae5a6f5dbe78a8a58655d17b43b93c078f094ddc476ae297",
|
"sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094",
|
||||||
"sha256:fa7bd7bd2771287c0de303af8bfdfc731f51bd2c6a47ab69d117138893b82717"
|
"sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.6'",
|
"markers": "python_version >= '3.7'",
|
||||||
"version": "==2.14.0"
|
"version": "==2.15.0"
|
||||||
},
|
},
|
||||||
"six": {
|
"six": {
|
||||||
"hashes": [
|
"hashes": [
|
2
debian/rules
vendored
2
debian/rules
vendored
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
export DEB_VERSION=$(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
|
export DEB_VERSION=$(shell dpkg-parsechangelog | grep -E '^Version:' | cut -f 2 -d ' ')
|
||||||
export BUILD_VERSION=v${DEB_VERSION}-debian-pragmatic
|
export BUILD_VERSION=v${DEB_VERSION}-debian-pragmatic
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
[pytest]
|
|
||||||
# run all tests sequentially, drop to pdb on first failure
|
|
||||||
addopts = -n 0 --no-header --pdb --pdbcls=IPython.terminal.debugger:Pdb
|
|
||||||
env_files =
|
|
||||||
.env
|
|
||||||
default.env
|
|
|
@ -1,7 +0,0 @@
|
||||||
[pytest]
|
|
||||||
# run all tests in parallel, compact output
|
|
||||||
addopts = -n 4 --no-header
|
|
||||||
required_plugins = pytest-xdist
|
|
||||||
env_files =
|
|
||||||
.env
|
|
||||||
default.env
|
|
|
@ -1,11 +0,0 @@
|
||||||
|
|
||||||
pytest_plugins = ("cs",)
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
|
||||||
config.addinivalue_line(
|
|
||||||
'markers', 'docker: mark tests for lone or manually orchestrated containers'
|
|
||||||
)
|
|
||||||
config.addinivalue_line(
|
|
||||||
'markers', 'compose: mark tests for docker compose projects'
|
|
||||||
)
|
|
2
go.mod
2
go.mod
|
@ -38,7 +38,7 @@ require (
|
||||||
github.com/jackc/pgx/v4 v4.14.1
|
github.com/jackc/pgx/v4 v4.14.1
|
||||||
github.com/jarcoal/httpmock v1.1.0
|
github.com/jarcoal/httpmock v1.1.0
|
||||||
github.com/jszwec/csvutil v1.5.1
|
github.com/jszwec/csvutil v1.5.1
|
||||||
github.com/mattn/go-sqlite3 v1.14.15
|
github.com/mattn/go-sqlite3 v1.14.16
|
||||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
|
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
|
||||||
github.com/nxadm/tail v1.4.8
|
github.com/nxadm/tail v1.4.8
|
||||||
github.com/oschwald/geoip2-golang v1.4.0
|
github.com/oschwald/geoip2-golang v1.4.0
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -674,6 +674,8 @@ github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4
|
||||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||||
|
|
14
pytest.ini
Normal file
14
pytest.ini
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[pytest]
|
||||||
|
required_plugins = pytest-xdist
|
||||||
|
addopts =
|
||||||
|
--pdbcls=IPython.terminal.debugger:Pdb
|
||||||
|
--ignore=rpm
|
||||||
|
--strict-markers
|
||||||
|
-m "not (deb or rpm)"
|
||||||
|
-n auto
|
||||||
|
markers:
|
||||||
|
deb: tests for .deb packaging
|
||||||
|
rpm: tests for .rpm packaging
|
||||||
|
env_files =
|
||||||
|
.env
|
||||||
|
default.env
|
0
test/e2e/conftest.py
Normal file
0
test/e2e/conftest.py
Normal file
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_no_agent(crowdsec, flavor):
|
def test_no_agent(crowdsec, flavor):
|
||||||
"""Test DISABLE_AGENT=true"""
|
"""Test DISABLE_AGENT=true"""
|
|
@ -3,10 +3,6 @@
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_split_lapi_agent(crowdsec, flavor):
|
def test_split_lapi_agent(crowdsec, flavor):
|
||||||
rand = str(random.randint(0, 10000))
|
rand = str(random.randint(0, 10000))
|
|
@ -8,10 +8,6 @@ import hashlib
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def hex512(s):
|
def hex512(s):
|
||||||
"""Return the sha512 hash of a string as a hex string"""
|
"""Return the sha512 hash of a string as a hex string"""
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_no_capi(crowdsec, flavor):
|
def test_no_capi(crowdsec, flavor):
|
||||||
"""Test no CAPI (disabled by default in tests)"""
|
"""Test no CAPI (disabled by default in tests)"""
|
|
@ -4,10 +4,6 @@ import datetime
|
||||||
|
|
||||||
from pytest_cs import Status
|
from pytest_cs import Status
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_cold_logs(crowdsec, tmp_path_factory, flavor):
|
def test_cold_logs(crowdsec, tmp_path_factory, flavor):
|
||||||
env = {
|
env = {
|
9
test/e2e/test_deb.py
Normal file
9
test/e2e/test_deb.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.deb
|
||||||
|
|
||||||
|
|
||||||
|
def test_buildpackage(deb_package_path):
|
||||||
|
"""Test that the package can be built."""
|
||||||
|
assert deb_package_path.exists(), f'Package {deb_package_path} not found'
|
|
@ -6,10 +6,6 @@ Test basic behavior of all the image variants
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_cscli_lapi(crowdsec, flavor):
|
def test_cscli_lapi(crowdsec, flavor):
|
||||||
"""Test if cscli can talk to lapi"""
|
"""Test if cscli can talk to lapi"""
|
|
@ -6,10 +6,6 @@ Smoke tests in case docker is not set up correctly or has connection issues.
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_docker_cli_run():
|
def test_docker_cli_run():
|
||||||
"""Test if docker run works from the command line. Capture stdout too"""
|
"""Test if docker run works from the command line. Capture stdout too"""
|
|
@ -7,10 +7,6 @@ Test pre-installed hub items.
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_preinstalled_hub(crowdsec, flavor):
|
def test_preinstalled_hub(crowdsec, flavor):
|
||||||
"""Test hub objects installed in the entrypoint"""
|
"""Test hub objects installed in the entrypoint"""
|
|
@ -9,11 +9,8 @@ import json
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
|
|
||||||
import pytest
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_install_two_collections(crowdsec, flavor):
|
def test_install_two_collections(crowdsec, flavor):
|
||||||
"""Test installing collections at startup"""
|
"""Test installing collections at startup"""
|
|
@ -7,10 +7,6 @@ Test parser management
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_install_two_parsers(crowdsec, flavor):
|
def test_install_two_parsers(crowdsec, flavor):
|
||||||
"""Test installing parsers at startup"""
|
"""Test installing parsers at startup"""
|
|
@ -8,8 +8,6 @@ from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_install_two_postoverflows(crowdsec, flavor):
|
def test_install_two_postoverflows(crowdsec, flavor):
|
||||||
"""Test installing postoverflows at startup"""
|
"""Test installing postoverflows at startup"""
|
|
@ -7,10 +7,6 @@ Test scenario management
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_install_two_scenarios(crowdsec, flavor):
|
def test_install_two_scenarios(crowdsec, flavor):
|
||||||
"""Test installing scenarios at startup"""
|
"""Test installing scenarios at startup"""
|
|
@ -4,8 +4,6 @@ from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_local_api_url_default(crowdsec, flavor):
|
def test_local_api_url_default(crowdsec, flavor):
|
||||||
"""Test LOCAL_API_URL (default)"""
|
"""Test LOCAL_API_URL (default)"""
|
|
@ -4,8 +4,6 @@ from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_metrics_port_default(crowdsec, flavor):
|
def test_metrics_port_default(crowdsec, flavor):
|
||||||
"""Test metrics"""
|
"""Test metrics"""
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
from pytest_cs import Status
|
from pytest_cs import Status
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_no_agent(crowdsec, flavor):
|
def test_no_agent(crowdsec, flavor):
|
||||||
"""Test DISABLE_LOCAL_API=true (failing stand-alone container)"""
|
"""Test DISABLE_LOCAL_API=true (failing stand-alone container)"""
|
|
@ -1,9 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
# XXX this is redundant, already tested in pytest_cs
|
# XXX this is redundant, already tested in pytest_cs
|
||||||
def test_crowdsec(crowdsec, flavor):
|
def test_crowdsec(crowdsec, flavor):
|
|
@ -8,10 +8,6 @@ import random
|
||||||
|
|
||||||
from pytest_cs import Status
|
from pytest_cs import Status
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_missing_key_file(crowdsec, flavor):
|
def test_missing_key_file(crowdsec, flavor):
|
||||||
"""Test that cscli and agent can communicate to LAPI with TLS"""
|
"""Test that cscli and agent can communicate to LAPI with TLS"""
|
|
@ -1,9 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_version_docker_platform(crowdsec, flavor):
|
def test_version_docker_platform(crowdsec, flavor):
|
||||||
with crowdsec(flavor=flavor) as cs:
|
with crowdsec(flavor=flavor) as cs:
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.docker
|
|
||||||
|
|
||||||
|
|
||||||
def test_use_wal_default(crowdsec, flavor):
|
def test_use_wal_default(crowdsec, flavor):
|
||||||
"""Test USE_WAL default"""
|
"""Test USE_WAL default"""
|
Loading…
Reference in a new issue