Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/ export-ignore
89 changes: 89 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# +-------------------------------------------------------------------------+
# | Copyright (C) 2004-2026 The Cacti Group |
# +-------------------------------------------------------------------------+
# | Cacti: The Complete RRDtool-based Graphing Solution |
# +-------------------------------------------------------------------------+

name: MacTrack Test Suite

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

permissions:
contents: read

jobs:
fast-suite:
name: Unit and contracts (PHP ${{ matrix.php }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout plugin
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install PHP ${{ matrix.php }}
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2

- name: Install locked dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run cohesive fast suite
run: php tests/run.php all

docker-integration:
name: Clean Cacti install (${{ matrix.database.name }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
database:
- name: MariaDB 10.11
image: mariadb:10.11
- name: MySQL 8.0
image: mysql:8.0
steps:
- name: Checkout Cacti
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Cacti/cacti
ref: 1e8eaca26b84b128c39ce8cc8ece42d7ff76aac1 # release/1.2.31
path: cacti

- name: Checkout plugin
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: cacti/plugins/mactrack

- name: Install PHP tooling
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
with:
php-version: '8.2'
coverage: none
tools: composer:v2

- name: Install plugin dependencies
working-directory: cacti/plugins/mactrack
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run clean-install Docker suite
env:
CACTI_SOURCE: ${{ github.workspace }}/cacti
MACTRACK_SOURCE: ${{ github.workspace }}/cacti/plugins/mactrack
DB_IMAGE: ${{ matrix.database.image }}
DB_USER: mactrack_ci
DB_PASSWORD: mactrack-ci-password
run: bash cacti/plugins/mactrack/tests/e2e/run-mactrack-e2e.sh
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* issue#246: Fix Cisco device collection
* issue#248: Cacti process control, terminate dns resolvet when is nothing to do
* issue#250: Disable automatic MIBs load
* issue#357: Prevent repeated database setup from duplicating the Default site
* issue: Uncaught type error in mactrack_view_arp.php for ifName
* issue: Mactrack does not shutdown properly due to incorrect use of unregister_process
* issue: Fixing some internationalization (i18n) issues
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@ Some basic documentation and steps to follow as well as some troubleshooting
tips you can find on the [MacTrack
Wiki](https://github.com/Cacti/plugin_mactrack/wiki)!

## Testing

The standalone suite runs without Composer and groups the fast checks by scope:

```sh
php tests/run.php all
php tests/run.php unit integration security e2e-static
```

The clean-install integration test installs Cacti and MacTrack in disposable
Docker containers, validates the plugin lifecycle and database schema, and
loads a real MacTrack page:

```sh
CACTI_SOURCE=/path/to/cacti \
MACTRACK_SOURCE="$PWD" \
bash tests/e2e/run-mactrack-e2e.sh
```

Pull requests run the standalone suite across the PHP CI matrix and the
clean-install Docker test against the minimum supported Cacti release.

## Workflow

Configure mactrack - Console -> Settings -> Mactrack tab
Expand Down
17 changes: 6 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@
"type": "cacti-plugin",
"license": "GPL-2.0-or-later",
"require-dev": {
"pestphp/pest": "^1.23",
"phpunit/phpunit": "^9.6",
"vimeo/psalm": "^5"
},
"scripts": {
"test": "pest",
"test:unit": "pest tests/Pest/Unit",
"test:integration": "pest tests/Pest/Integration",
"test:e2e:static": "pest tests/Pest/E2E",
"test:coverage": "pest --coverage",
"test": "php tests/run.php all",
"test:unit": "php tests/run.php unit",
"test:integration": "php tests/run.php integration",
"test:security": "php tests/run.php security",
"test:e2e:static": "php tests/run.php e2e-static",
"analyse": "psalm --no-progress"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
},
"platform": {
"php": "8.2.0"
"php": "7.4.0"
},
"sort-packages": true
},
Expand Down
Loading