Commit graph

32 commits

Author SHA1 Message Date
2a310c6685
Fix test warnings and failures
- Add Phoenix.LiveViewTest import to ConnCase to fix warnings
- Disable AppSignal in dev and test (only enable in prod)
- Explicitly disable clustering in test environment
- Fix PacketDistributor to check cluster_enabled before calling LeaderElection
- Add Phoenix.CodeReloader listener to mix.exs

This prevents tests from trying to call cluster-specific GenServers
(ConnectionMonitor, LeaderElection) that don't exist in test mode.
2025-10-25 17:41:58 -05:00
41cc642d7e
Fix compile warnings and add comprehensive mobile channel tests
- Fix unsubscribe_from_bounds -> unsubscribe (function doesn't exist)
- Fix search_callsign query to use 'lon' instead of 'lng' field
- Add comprehensive test suite for mobile channel:
  - Join and subscription tests
  - Bounds validation tests
  - Callsign search tests
  - Callsign tracking tests
  - Streaming packet tests
  - Packet data format tests
  - 29 tests total, all passing

Created test/support/channel_case.ex for channel testing infrastructure.

Generated with Claude Code https://claude.com/claude-code
2025-10-25 13:18:55 -05:00
d75896597e
fix: resolve test failures and improve error handling
- Fix duplicate bad packet storage in store_packet function
  - Changed insert_packet to return specific error tuples
  - Handle validation_error and storage_exception separately
  - Prevent double storage of bad packets

- Add try/catch wrapper around insert_packet for exception handling
  - Properly catch and return storage_exception errors
  - Test now correctly expects :storage_exception

- Add helper function for LiveView tests with duplicate IDs
  - Added live_with_warn/2 to ConnCase
  - Suppress duplicate ID warnings in integration tests

- Fix unused variable warning in insert_packet

All packet tests now pass without failures.
2025-10-13 09:26:40 -05:00
4ac70a52c1
fix: Ensure integration tests properly trigger historical packet loading
The integration tests were failing because historical packets weren't
loading automatically. The tests needed to properly trigger the bounds
update event after the map initializes.

Changes:
- Add PostGIS location field to packet fixtures when lat/lon are provided
- Execute JavaScript to manually trigger bounds update after map loads
- This ensures the sendBoundsToServer function is called
- Adjusted timing to wait for map initialization before triggering

This should make the integration tests more reliable by ensuring
historical packets are loaded after the map is ready.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 15:57:48 -05:00
b5a39102a6
fix: Comprehensive packet processing and test optimization improvements
This commit includes several critical fixes and optimizations:

## Production Buffer Overflow Fix
- Fixed telemetry_vals data type conversion from strings to integers
- Enhanced put_telemetry_fields() with robust type conversion logic
- Handles mixed data types (string, integer, float) gracefully
- Prevents PacketConsumer GenServer crashes that caused buffer overflow
- Processes telemetry from both data_extended and top-level attrs

## Test Suite Performance Optimization
- Improved test execution speed by 48% (43.2s → 24.1s)
- Increased parallelization: max_cases from 16 to 48
- Optimized database connections and reduced timeouts
- Tagged slow tests and exclude them by default for fast development
- Fixed device seeding to only run when needed
- Enhanced log capture for packet consumer tests

## Code Quality Improvements
- Fixed handle_info clause grouping in LeaderElection
- Ensures mix compile --warnings-as-errors passes
- Added comprehensive telemetry conversion tests
- Improved test reliability and reduced flakiness

## Infrastructure Updates
- Added migration init container to StatefulSet for automatic schema updates
- Disabled AUTO_MIGRATE in main container (handled by init container)
- Created .test-commands with helpful test aliases

This resolves production stability issues and significantly improves development workflow.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:50:07 -05:00
b9cb8cf1a3
perf: Optimize test suite for maximum speed
Major performance improvements to test execution:
- Increase max_cases from 16 to 48 for better parallelization
- Increase DB pool size for concurrent tests
- Reduce DB timeouts and enable queue optimization
- Disable logging during tests (level: :error)
- Tag slow tests and exclude them by default
- Only seed devices for tests that need them
- Fixed log capture test for packet consumer
- Fixed flaky leader election test with proper timing

Performance improvements:
- Fast tests: 43.2s -> 24.1s (48% faster)
- All tests still pass with --exclude flags removed
- Created .test-commands with helpful aliases

Usage:
- mix test --exclude slow --exclude integration  # Fast development tests
- mix test  # All tests including slow ones

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:43:39 -05:00
41c148650d
refactor: Remove CachedQueries and rename optimized functions
- Remove all CachedQueries usage throughout the codebase
- Replace with direct Packets module calls
- Delete CachedQueries module entirely
- Rename get_recent_packets_optimized to get_recent_packets
- Add has_weather_packets? function to Packets module
- Fix duplicate function definitions
- Update all test references to use new function names

This simplifies the codebase by removing the caching layer and
eliminates the database ownership errors in tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 13:17:56 -05:00
610a5b8949
refactor 2025-07-13 16:49:20 -05:00
38920e9f3d
add callsign to users 2025-07-10 16:07:05 -05:00
73d67da457
actually add m ore files 2025-07-10 15:44:39 -05:00
a1ac8abc1e
fix some tests 2025-07-10 15:44:28 -05:00
48447ab42e
refactor and performance improvements 2025-07-10 10:53:34 -05:00
6d9b878a17
clean up warnings 2025-07-08 13:29:44 -05:00
5ad101a69e
passing tests 2025-07-07 16:29:38 -05:00
0beb278371
add packet batcher 2025-06-24 15:06:09 -05:00
ce7c50caa1
refactor to use external parser 2025-06-24 14:22:09 -05:00
54b3bbf522
better device parsing 2025-06-23 14:25:19 -05:00
a48b2edcb3
add device identifier 2025-06-23 14:19:04 -05:00
fc94ec45a8
more tests 2025-06-23 11:01:32 -05:00
Fly Dev
7f4cc74348 Clean up remaining test files and remove unused mocks
- Remove unused mocks.ex file
- Clean up time_helpers_test.exs
- Complete test suite cleanup after fixing all errors and warnings
2025-06-23 14:50:03 +00:00
Fly Dev
9b7ab75f31 fix MockHelpers to prevent redefinition of mocks 2025-06-23 14:21:48 +00:00
Fly Dev
969dc1ee81 update MockHelpers to stub all expected functions 2025-06-23 14:21:16 +00:00
Fly Dev
06a42bd806 fix MockHelpers to use correct Packets behaviour 2025-06-23 14:20:28 +00:00
Fly Dev
50bcca9772 create mock_helpers for tests 2025-06-23 14:20:18 +00:00
a05ec4b32c
refactoring 2025-06-22 10:49:35 -05:00
d6ac5cccfc
fixes 2025-06-21 12:26:43 -05:00
3b8d1f2cff
storing fix 2025-06-16 13:11:58 -05:00
6e8f1e434f
dont connect to is server in test 2025-06-16 12:45:35 -05:00
ff9eb9c614 update everything 2025-01-22 12:12:39 -06:00
da296d852d auto style things 2023-12-17 12:11:57 -06:00
7b874d9afa add auth 2023-01-29 13:29:25 -06:00
d40567dfeb initial 2023-01-26 13:20:23 -06:00