blob: b33926144cb65676f9615dbc181596bf25913dc0 [file] [log] [blame]
Sean Condonaf0eb3c2021-09-19 20:14:29 +01001# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
Scott Baker69654392021-09-17 13:50:16 -07002#
Sean Condon160ec1d2022-02-08 12:58:25 +00003# SPDX-License-Identifier: Apache-2.0
Scott Baker69654392021-09-17 13:50:16 -07004
5.PHONY: all test clean
6
Scott Baker69654392021-09-17 13:50:16 -07007all: test
8
Ray Milkey35a07f82021-10-26 15:05:43 -07009test: # @HELP run the acceptance tests
Amit Wankhede751e7cd2022-03-23 17:08:30 +000010test: deps opa-test
11
12opa-test: #@HELP run the rego rule tests
13opa-test:
14 @cd aether-roc-umbrella/files/opa-rbac && for test_file in test/*; do \
15 trimmed=`basename $$test_file .json`;\
16 case "$$trimmed" in \
SeanCondon172097c2022-05-10 09:57:48 +010017 *2.0.0*) docker run --platform linux/amd64 -v $$(pwd):/opa-rbac openpolicyagent/opa:0.40.0 eval -f pretty -b /opa-rbac \
Amit Wankhede751e7cd2022-03-23 17:08:30 +000018 --input opa-rbac/test/$$trimmed.json data.aether_2_0_x.allowed > /tmp/$$trimmed.out;;\
SeanCondon172097c2022-05-10 09:57:48 +010019 *2.1.0*) docker run --platform linux/amd64 -v $$(pwd):/opa-rbac openpolicyagent/opa:0.40.0 eval -f pretty -b /opa-rbac \
20 --input opa-rbac/test/$$trimmed.json data.aether_2_1_x.allowed > /tmp/$$trimmed.out;;\
Amit Wankhede751e7cd2022-03-23 17:08:30 +000021 *) continue;;esac;\
SeanCondon172097c2022-05-10 09:57:48 +010022 cmp -b /tmp/$$trimmed.out test/out/$$trimmed.out \
Amit Wankhede751e7cd2022-03-23 17:08:30 +000023 && echo "[TEST] $$trimmed.json : PASS"|| echo "[TEST] $$trimmed.json : FAIL";\
24 done;
Ray Milkey35a07f82021-10-26 15:05:43 -070025
26roc-test: # @HELP run the integration tests
27roc-test: deps # @HELP run the integration tests
Sean Condonaf0eb3c2021-09-19 20:14:29 +010028 ./build/bin/run-roc-test
Scott Baker69654392021-09-17 13:50:16 -070029
Sean Condonaf0eb3c2021-09-19 20:14:29 +010030clean: # @HELP clean up temporary files for ROC umbrella.
SeanCondon3c3d08f2022-05-27 11:39:58 +010031 rm -rf aether-roc-umbrella/charts aether-roc-umbrella/Chart.lock chronos-umbrella/charts chronos-umbrella/Chart.lock fabric-umbrella/charts fabric-umbrella/Chart.lock
Scott Baker69654392021-09-17 13:50:16 -070032
Sean Condonaf0eb3c2021-09-19 20:14:29 +010033deps: # @HELP build dependencies for ROC Umbrella local charts.
Scott Baker69654392021-09-17 13:50:16 -070034deps: clean
Sean Condonaf0eb3c2021-09-19 20:14:29 +010035 helm dep build aether-roc-umbrella
Scott Baker69654392021-09-17 13:50:16 -070036
Sean Condonb0769e62021-12-21 09:57:29 +000037deps-chronos: # @HELP build dependencies for Chronos Umbrella local charts.
38deps-chronos: clean
39 rm -rf chronos-umbrella/Chart.lock chronos-umbrella/charts
40 helm dep build chronos-umbrella
41
Scott Baker69654392021-09-17 13:50:16 -070042help:
43 @grep -E '^.*: *# *@HELP' $(MAKEFILE_LIST) \
44 | sort \
45 | awk ' \
46 BEGIN {FS = ": *# *@HELP"}; \
47 {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}; \
48 '
PUSHP RAJba2e32f2021-11-02 10:39:24 +000049
Sean Condondccb3142022-01-10 14:36:16 +000050reuse-lint:
Sean Condon65dbad92022-02-04 13:36:47 +000051 reuse --root . lint