Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Memcached adapter; add test #554

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

colemanja91
Copy link
Contributor

The Memcached adapter can't currently be used because it isn't required in coverband.rb. Adding that, and a basic test to ensure that it works:

bundle exec rake COVERBAND_MEMCACHED=1             
/Users/alliecoleman/.rbenv/versions/3.2.0/bin/ruby -w -I"lib:lib:test" /Users/alliecoleman/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rake-13.2.1/lib/rake/rake_test_loader.rb "test/integration/full_stack_deferred_eager_test.rb" "test/integration/full_stack_send_deferred_eager_test.rb" "test/integration/full_stack_test.rb" "test/coverband/adapters/base_test.rb" "test/coverband/adapters/file_store_test.rb" "test/coverband/adapters/hash_redis_store_test.rb" "test/coverband/adapters/memecached_store_test.rb" "test/coverband/adapters/null_store_test.rb" "test/coverband/adapters/redis_store_test.rb" "test/coverband/adapters/web_service_store_test.rb" "test/coverband/at_exit_test.rb" "test/coverband/collectors/coverage_test.rb" "test/coverband/collectors/delta_test.rb" "test/coverband/collectors/route_tracker_test.rb" "test/coverband/collectors/translation_tracker_test.rb" "test/coverband/collectors/view_tracker_test.rb" "test/coverband/configuration_test.rb" "test/coverband/coverband_test.rb" "test/coverband/integrations/background_middleware_test.rb" "test/coverband/integrations/background_test.rb" "test/coverband/integrations/rack_server_check_test.rb" "test/coverband/integrations/report_middleware_test.rb" "test/coverband/integrations/resque_worker_test.rb" "test/coverband/reporters/base_test.rb" "test/coverband/reporters/console_test.rb" "test/coverband/reporters/html_test.rb" "test/coverband/reporters/json_test.rb" "test/coverband/reporters/web_test.rb" "test/coverband/utils/absolute_file_converter_test.rb" "test/coverband/utils/dead_methods_test.rb" "test/coverband/utils/file_hasher_test.rb" "test/coverband/utils/file_list_test.rb" "test/coverband/utils/html_formatter_test.rb" "test/coverband/utils/lines_classifier_test.rb" "test/coverband/utils/method_definition_scanner_test.rb" "test/coverband/utils/relative_file_converter_test.rb" "test/coverband/utils/result_test.rb" "test/coverband/utils/results_test.rb" "test/coverband/utils/source_file_line_test.rb" "test/coverband/utils/source_file_test.rb" 
D, [2024-10-10T11:55:55.402362 #57167] DEBUG -- : using default configuration
/Users/alliecoleman/Workspace/coverband/test/test_helper.rb:184: warning: method redefined; discarding old test_env
Run options: --seed 4615

# Running:

...........coverband_test_RouteTracker_tracker key {:controller=>"some/controller", :action=>"index", :url_path=>nil, :verb=>"GET"}
.............gem tracking is deprecated, setting this will be ignored & eventually removed
.gem tracking is deprecated, setting this will be ignored & eventually removed
/Users/alliecoleman/Workspace/coverband/test/unique_files/969ff24d-a9e3-4659-951f-36a1e67d1f79/fake_app/basic_rack.rb:6: warning: method redefined; discarding old call
/Users/alliecoleman/Workspace/coverband/test/unique_files/a5cb6862-609b-48a7-9913-bfa0d93d223e/fake_app/basic_rack.rb:6: warning: previous definition of call was here
....................................../Users/alliecoleman/Workspace/coverband/test/unique_files/3b4a582a-d182-421b-a145-4f0f3e0cb2c5/dog.rb:4: warning: method redefined; discarding old bark
/Users/alliecoleman/Workspace/coverband/test/dog.rb:4: warning: previous definition of bark was here
..E, [2024-10-10T11:55:55.737940 #57167] ERROR -- : coverage failed to store
E, [2024-10-10T11:55:55.737980 #57167] ERROR -- : Coverband Error: #<RuntimeError: Oh no> Oh no
......./Users/alliecoleman/Workspace/coverband/test/unique_files/345ba460-71b0-4817-9bf6-ccc05f337afc/dog.rb:4: warning: method redefined; discarding old bark
/Users/alliecoleman/Workspace/coverband/test/unique_files/3b4a582a-d182-421b-a145-4f0f3e0cb2c5/dog.rb:4: warning: previous definition of bark was here
.........................................S................................................../Users/alliecoleman/Workspace/coverband/test/unique_files/4cdf7b77-1738-4288-9d08-6ec7fe1ae499/dog.rb:4: warning: method redefined; discarding old bark
/Users/alliecoleman/Workspace/coverband/test/unique_files/345ba460-71b0-4817-9bf6-ccc05f337afc/dog.rb:4: warning: previous definition of bark was here
./Users/alliecoleman/Workspace/coverband/test/unique_files/33906018-92ca-4c74-b0ad-f55735e57c98/dog.rb:4: warning: method redefined; discarding old bark
/Users/alliecoleman/Workspace/coverband/test/unique_files/4cdf7b77-1738-4288-9d08-6ec7fe1ae499/dog.rb:4: warning: previous definition of bark was here
./Users/alliecoleman/Workspace/coverband/test/unique_files/603e84d3-835d-4488-b069-cd57bf40c384/dog.rb:4: warning: method redefined; discarding old bark
/Users/alliecoleman/Workspace/coverband/test/unique_files/33906018-92ca-4c74-b0ad-f55735e57c98/dog.rb:4: warning: previous definition of bark was here
----------------------------------------------------------------------------------------------------------------------------------------------------------
| file                                                            | class                     | method                                     | line_number |
| ./lib/coverband/integrations/resque.rb                          |                           | perform                                    | 17          |
| ./lib/coverband/integrations/resque.rb                          |                           | perform_with_coverband                     | 27          |
| ./lib/coverband/reporters/web.rb                                | Web                       | json                                       | 127         |
| ./lib/coverband/reporters/web.rb                                | Web                       | report_json                                | 131         |
| ./lib/coverband/reporters/web.rb                                | Web                       | settings                                   | 143         |
| ./lib/coverband/reporters/web.rb                                | Web                       | display_abstract_tracker                   | 148         |
| ./lib/coverband/reporters/web.rb                                | Web                       | view_tracker_data                          | 159         |
| ./lib/coverband/reporters/web.rb                                | Web                       | debug_data                                 | 163         |
| ./lib/coverband/reporters/web.rb                                | Web                       | enriched_debug_data                        | 167         |
| ./lib/coverband/reporters/web.rb                                | Web                       | load_file_details                          | 175         |
| ./lib/coverband/reporters/web.rb                                | Web                       | clear_file                                 | 193         |
| ./lib/coverband/reporters/web.rb                                | Web                       | clear_abstract_tracking                    | 204         |
| ./lib/coverband/reporters/web.rb                                | Web                       | clear_abstract_tracking_key                | 214         |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | format_dynamic_data!                       | 30          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | format_settings!                           | 34          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | format_abstract_tracker!                   | 38          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | format_settings                            | 54          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | format                                     | 58          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | format_data                                | 72          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | output_path                                | 81          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | asset_output_path                          | 85          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | served_html?                               | 93          |
| ./lib/coverband/utils/html_formatter.rb                         | HTMLFormatter             | button                                     | 101         |
| ./lib/coverband/utils/result.rb                                 | Result                    | created_at                                 | 45          |
| ./lib/coverband/utils/file_list.rb                              | FileList                  | formatted_covered_percent                  | 62          |
| ./lib/coverband/utils/source_file.rb                            | SourceFile                | runtime_relavant_calculations              | 117         |
| ./lib/coverband/utils/source_file.rb                            | SourceFile                | project_filename                           | 125         |
| ./lib/coverband/utils/source_file.rb                            | SourceFile                | line                                       | 165         |
| ./lib/coverband/utils/source_file.rb                            | SourceFile                | relative_path                              | 263         |
| ./lib/coverband/utils/results.rb                                | Results                   | respond_to_missing?                        | 72          |
| ./lib/coverband/utils/results.rb                                | Results                   | groups                                     | 77          |
| ./lib/coverband/utils/results.rb                                | Results                   | created_at                                 | 81          |
| ./lib/coverband/utils/results.rb                                | Results                   | command_name                               | 85          |
| ./lib/coverband/reporters/html_report.rb                        | HTMLReport                | report_data                                | 36          |
| ./lib/coverband/reporters/html_report.rb                        | HTMLReport                | report_dynamic_data                        | 49          |
| ./lib/coverband/reporters/json_report.rb                        | JSONReport                | initialize                                 | 11          |
| ./lib/coverband/reporters/json_report.rb                        | JSONReport                | report                                     | 30          |
| ./lib/coverband/reporters/json_report.rb                        | JSONReport                | merge_reports                              | 34          |
| ./lib/coverband/reporters/json_report.rb                        | JSONReport                | coverage_css_class                         | 63          |
| ./lib/coverband/reporters/json_report.rb                        | JSONReport                | report_as_json                             | 75          |
| ./lib/coverband/reporters/json_report.rb                        | JSONReport                | coverage_totals                            | 117         |
| ./lib/coverband/reporters/json_report.rb                        | JSONReport                | coverage_files                             | 129         |
| ./test/unique_files.rb                                          |                           | require_class_unique_file                  | 23          |
| ./test/unique_files.rb                                          |                           | remove_unique_files                        | 29          |
| ./test/integration/full_stack_test.rb                           | FullStackTest             | setup                                      | 10          |
| ./test/integration/full_stack_test.rb                           | FullStackTest             | fake_app_with_lines                        | 48          |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | test_covered_lines_when_no_file            | 6           |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | setup                                      | 13          |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | test_coverage                              | 23          |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | test_covered_lines_when_null               | 28          |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | test_covered_files                         | 32          |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | test_clear                                 | 36          |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | test_save_report                           | 41          |
| ./test/coverband/adapters/file_store_test.rb                    | AdaptersFileStoreTest     | test_data                                  | 48          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | setup                                      | 14          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | mock_time                                  | 25          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_no_coverage                           | 30          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | UnsupportedRedis          | info                                       | 36          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_unsupported_redis                     | 41          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_coverage_for_file                     | 47          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_ttl_set                               | 77          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_no_ttl_set                            | 86          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_coverage_for_multiple_files           | 95          |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_file_hash_change                      | 118         |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_type                                  | 128         |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_coverage_type                         | 150         |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_clear                                 | 161         |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_clear_file                            | 184         |
| ./test/coverband/adapters/hash_redis_store_test.rb              | HashRedisStoreTest        | test_split_coverage                        | 195         |
| ./test/coverband/adapters/null_store_test.rb                    | AdaptersNullStoreTest     | test_covered_lines_when_no_file            | 6           |
| ./test/coverband/adapters/web_service_store_test.rb             | WebServiceStoreTest       | setup                                      | 10          |
| ./test/coverband/adapters/web_service_store_test.rb             | WebServiceStoreTest       | test_coverage                              | 17          |
| ./test/coverband/adapters/web_service_store_test.rb             | WebServiceStoreTest       | test_no_webservice_call_without_api_key    | 32          |
| ./test/coverband/adapters/web_service_store_test.rb             | WebServiceStoreTest       | test_clear                                 | 38          |
| ./test/coverband/adapters/web_service_store_test.rb             | WebServiceStoreTest       | test_clear_file                            | 44          |
| ./test/coverband/adapters/web_service_store_test.rb             | WebServiceStoreTest       | test_size                                  | 50          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | logger                                     | 23          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | clear!                                     | 27          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | clear_file!                                | 32          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | size                                       | 39          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | coverage                                   | 48          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | save_report                                | 63          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | raw_store                                  | 92          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | retry_failed_reports                       | 98          |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | add_retry_message                          | 111         |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | save_coverage                              | 119         |
| ./lib/coverband/adapters/web_service_store.rb                   | WebServiceStore           | send_report_body                           | 132         |
| ./test/coverband/collectors/translation_tracker_test.rb         | TranslationTrackerTest    | tracker_key                                | 10          |
| ./test/coverband/collectors/translation_tracker_test.rb         | TranslationTrackerTest    | tracker_time_key                           | 15          |
| ./test/coverband/collectors/translation_tracker_test.rb         | TranslationTrackerTest    | setup                                      | 20          |
| ./test/coverband/collectors/translation_tracker_test.rb         | TranslationTrackerTest    | fake_store                                 | 88          |
| ./test/coverband/collectors/view_tracker_test.rb                | ViewTrackerTest           | tracker_key                                | 6           |
| ./test/coverband/collectors/view_tracker_test.rb                | ViewTrackerTest           | setup                                      | 10          |
| ./test/coverband/collectors/view_tracker_test.rb                | ViewTrackerTest           | fake_store                                 | 133         |
| ./test/coverband/integrations/background_test.rb                | ThreadDouble              | exit                                       | 7           |
| ./test/coverband/integrations/report_middleware_test.rb         | ReportMiddlewareTest      | setup                                      | 7           |
| ./test/coverband/integrations/report_middleware_test.rb         | ReportMiddlewareTest      | fake_app                                   | 35          |
| ./test/coverband/integrations/report_middleware_test.rb         | ReportMiddlewareTest      | fake_app_raise_error                       | 41          |
| ./lib/coverband/integrations/report_middleware.rb               | ReportMiddleware          | initialize                                 | 5           |
| ./lib/coverband/integrations/report_middleware.rb               | ReportMiddleware          | call                                       | 9           |
| ./test/coverband/integrations/resque_worker_test.rb             | ResqueWorkerTest          | enqueue_and_run_job                        | 10          |
| ./test/coverband/integrations/resque_worker_test.rb             | ResqueWorkerTest          | setup                                      | 18          |
| ./test/coverband/reporters/json_test.rb                         | ReportJSONTest            | setup                                      | 6           |
| ./test/coverband/utils/dead_methods_test.rb                     | DeadMethodsTest           | test_all_dead_methods                      | 29          |
| ./lib/coverband/utils/dead_methods.rb                           |                           | to_table                                   | 9           |
| ./test/coverband/utils/file_hasher_test.rb                      | FileHasherTest            | test_hash_same_file                        | 8           |
| ./test/coverband/utils/file_hasher_test.rb                      | FileHasherTest            | test_hash_different_files                  | 14          |
| ./test/coverband/utils/file_hasher_test.rb                      | FileHasherTest            | test_hash_file_not_exists                  | 18          |
| ./test/coverband/utils/relative_file_converter_test.rb          | RelativeFileConverterTest | test_convert                               | 8           |
| ./test/coverband/utils/relative_file_converter_test.rb          | RelativeFileConverterTest | test_convert_without_leading_forward_slash | 13          |
| ./test/coverband/utils/relative_file_converter_test.rb          | RelativeFileConverterTest | test_multiple_roots                        | 18          |
| ./test/coverband/utils/relative_file_converter_test.rb          | RelativeFileConverterTest | test_no_match                              | 23          |
| ./test/coverband/utils/relative_file_converter_test.rb          | RelativeFileConverterTest | test_middle_path_match                     | 28          |
| ./test/coverband/utils/relative_file_converter_test.rb          | RelativeFileConverterTest | test_already_relative_file                 | 33          |
| ./test/unique_files/3b4a582a-d182-421b-a145-4f0f3e0cb2c5/dog.rb | Dog                       | bark                                       | 4           |
| ./test/unique_files/345ba460-71b0-4817-9bf6-ccc05f337afc/dog.rb | Dog                       | bark                                       | 4           |
| ./test/unique_files/4cdf7b77-1738-4288-9d08-6ec7fe1ae499/dog.rb | Dog                       | bark                                       | 4           |
| ./test/unique_files/33906018-92ca-4c74-b0ad-f55735e57c98/dog.rb | Dog                       | bark                                       | 4           |
| ./test/unique_files/603e84d3-835d-4488-b069-cd57bf40c384/dog.rb | Dog                       | bark                                       | 4           |
----------------------------------------------------------------------------------------------------------------------------------------------------------
./Users/alliecoleman/Workspace/coverband/test/unique_files/2a12ef65-2f49-4d8a-8963-c3c5f1804a43/dog.rb:4: warning: method redefined; discarding old bark
/Users/alliecoleman/Workspace/coverband/test/unique_files/603e84d3-835d-4488-b069-cd57bf40c384/dog.rb:4: warning: previous definition of bark was here
.....coverband_test_TranslationTracker_tracker key en.views.pagination.truncate
.........................Coverband: Error: no Coverband API key was found!
...Coverband: Error: no Coverband API key was found!
.........gem tracking is deprecated, setting this will be ignored & eventually removed
/Users/alliecoleman/Workspace/coverband/test/unique_files/8f1b38cc-7726-4ced-b3a0-af13e0802d69/fake_app/basic_rack.rb:6: warning: method redefined; discarding old call
/Users/alliecoleman/Workspace/coverband/test/unique_files/969ff24d-a9e3-4659-951f-36a1e67d1f79/fake_app/basic_rack.rb:6: warning: previous definition of call was here
...........D, [2024-10-10T11:55:57.783969 #57167] DEBUG -- : using default configuration
...........................................

Finished in 2.160142s, 121.7513 runs/s, 244.4284 assertions/s.

263 runs, 528 assertions, 0 failures, 0 errors, 1 skips

You have skipped tests. Run with --verbose for details.

@danmayer
Copy link
Owner

Cool. Yeah, I was thinking people might want to require only the adapters they need, but obviously, it has required the Redis ones for a while. This seems good for now, I might try to have a generic active support cache adapter in the future.

@danmayer
Copy link
Owner

Thanks @colemanja91 merging, I will try to test some of the recent PR merges and get a release out early next week

@danmayer danmayer merged commit 4e4bd3d into danmayer:main Oct 11, 2024
80 checks passed
@danmayer
Copy link
Owner

thanks @colemanja91 this is in the 6.1.3 release https://github.com/danmayer/coverband/releases/tag/v6.1.3

@colemanja91
Copy link
Contributor Author

Woohoo thanks!

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.

2 participants