Skip to content

Add tests for all platforms#64

Merged
neel5481 merged 1 commit intoEnterpriseDB:masterfrom
tureba:add-tests
Mar 23, 2026
Merged

Add tests for all platforms#64
neel5481 merged 1 commit intoEnterpriseDB:masterfrom
tureba:add-tests

Conversation

@tureba
Copy link
Copy Markdown
Contributor

@tureba tureba commented Feb 18, 2026

Adds testing infrastructure with make installcheck support for Linux, macOS/Darwin, and Windows platforms.

Test Infrastructure:

  • sql/smoke_test.sql: Quick sanity checks (1-2s runtime)
  • sql/system_stats.sql: Comprehensive test suite (5-10s runtime)
  • expected/*.out: Expected output files for regression testing

Test Coverage:
Tests all 10 system_stats functions:

  1. pg_sys_os_info - OS information (name, version, hostname, arch, boot time)
  2. pg_sys_cpu_info - CPU details (cores, clock speed, cache, architecture)
  3. pg_sys_memory_info - Memory stats (total, used, free, swap)
  4. pg_sys_disk_info - Disk information (space, inodes, filesystems)
  5. pg_sys_load_avg_info - Load averages (1, 5, 15 minute)
  6. pg_sys_cpu_usage_info - CPU usage percentages
  7. pg_sys_io_analysis_info - I/O statistics (reads, writes, bytes)
  8. pg_sys_process_info - Process counts (running, sleeping, zombie)
  9. pg_sys_network_info - Network stats (interfaces, TX/RX, errors)
  10. pg_sys_cpu_memory_by_process - Per-process CPU/memory usage

Test Categories:

  • Existence tests: Functions exist and return data
  • NULL handling: Required fields are populated
  • Data type validation: Correct PostgreSQL types
  • Range validation: Values within expected ranges
  • Consistency checks: Relationships between values are correct
  • Caching behavior: Multiple calls work correctly
  • Platform compatibility: Tests pass on Linux, Darwin, Windows

Adds testing infrastructure with make installcheck support for
Linux, macOS/Darwin, and Windows platforms.

Test Infrastructure:
- sql/smoke_test.sql: Quick sanity checks (1-2s runtime)
- sql/system_stats.sql: Comprehensive test suite (5-10s runtime)
- expected/*.out: Expected output files for regression testing

Test Coverage:
Tests all 10 system_stats functions:
1. pg_sys_os_info - OS information (name, version, hostname, arch, boot time)
2. pg_sys_cpu_info - CPU details (cores, clock speed, cache, architecture)
3. pg_sys_memory_info - Memory stats (total, used, free, swap)
4. pg_sys_disk_info - Disk information (space, inodes, filesystems)
5. pg_sys_load_avg_info - Load averages (1, 5, 15 minute)
6. pg_sys_cpu_usage_info - CPU usage percentages
7. pg_sys_io_analysis_info - I/O statistics (reads, writes, bytes)
8. pg_sys_process_info - Process counts (running, sleeping, zombie)
9. pg_sys_network_info - Network stats (interfaces, TX/RX, errors)
10. pg_sys_cpu_memory_by_process - Per-process CPU/memory usage

Test Categories:
- Existence tests: Functions exist and return data
- NULL handling: Required fields are populated
- Data type validation: Correct PostgreSQL types
- Range validation: Values within expected ranges
- Consistency checks: Relationships between values are correct
- Caching behavior: Multiple calls work correctly
- Platform compatibility: Tests pass on Linux, Darwin, Windows
@AndrewJackson2020
Copy link
Copy Markdown

This seems like a very important PR. Would be nice to get CI as well but that is probably out of scope here.

One thought which may be a bad idea: for linux mock a procfs in git controlled test assets and use that path in a test build instead of /proc so we could deterministically assert the expected values.

@neel5481 neel5481 merged commit 3d9af9d into EnterpriseDB:master Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants