freedomofpress / securedrop.org

Code for the SecureDrop project website
https://securedrop.org
GNU Affero General Public License v3.0
40 stars 9 forks source link

Investigate inconsistent test failure #443

Closed harrislapiroff closed 6 years ago

harrislapiroff commented 6 years ago

As detailed in https://github.com/freedomofpress/securedrop.org/pull/431#issuecomment-382420512

conorsch commented 6 years ago

Failed build was https://circleci.com/gh/freedomofpress/securedrop.org/1006.

Failure output: > TASK [Run tests] *************************************************************** fatal: [debian_jessie_sd.org_ci]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 1, "stderr": "\nRunning tests...\n----------------------------------------------------------------------\n test_authenticated_login_should_redirect_to_2fa_setup (accounts.tests.test_accounts.AuthenticatedTest)\nlogin without setting up a device should redirect to 2FA setup page ... OK (0.395s)\n test_authenticated_user_cannot_view_dashboard (accounts.tests.test_accounts.AuthenticatedTest)\ndashboard should redirect unverified users users to the login page ... OK (0.243s)\n test_unauthenticated_is_redirected_to_login_dashboard (accounts.tests.test_accounts.UnauthenticatedTest) ... OK (0.116s)\n test_unauthenticated_is_redirected_to_login_details (accounts.tests.test_accounts.UnauthenticatedTest) ... OK (0.079s)\n test_verified_user_can_edit_their_instances (accounts.tests.test_accounts.VerifiedTest) ... OK (0.328s)\n test_verified_user_can_view_dashboard (accounts.tests.test_accounts.VerifiedTest) ... OK (0.298s)\n test_verified_user_can_view_their_instances (accounts.tests.test_accounts.VerifiedTest) ... OK (0.315s)\n test_verified_user_cannot_edit_other_instances (accounts.tests.test_accounts.VerifiedTest) ... OK (0.310s)\n test_verified_user_cannot_view_other_instances (accounts.tests.test_accounts.VerifiedTest) ... OK (0.314s)\n test_create_url (accounts.tests.test_dashboard.ScanViewTest) ... OK (0.182s)\n test_get_posts_returns_newest_post_first (blog.tests.test_models.BlogIndexPageTest) ... OK (0.257s)\n test_get_posts_returns_oldest_post_last (blog.tests.test_models.BlogIndexPageTest) ... OK (0.291s)\n test_get_posts_should_not_return_unpublished_posts (blog.tests.test_models.BlogIndexPageTest) ... OK (0.081s)\n test_get_posts_should_return_live_posts (blog.tests.test_models.BlogIndexPageTest) ... OK (0.075s)\n test_get_posts_returns_newest_post_first (blog.tests.test_models.CategoryPageTest) ... OK (0.259s)\n test_get_posts_returns_oldest_post_last (blog.tests.test_models.CategoryPageTest) ... OK (0.282s)\n test_get_posts_should_not_return_posts_in_other_category (blog.tests.test_models.CategoryPageTest) ... OK (0.094s)\n test_get_posts_should_not_return_unpublished_posts (blog.tests.test_models.CategoryPageTest) ... OK (0.094s)\n test_get_posts_should_return_live_posts (blog.tests.test_models.CategoryPageTest) ... OK (0.093s)\n test_get_posts_should_return_posts_in_its_category (blog.tests.test_models.CategoryPageTest) ... OK (0.093s)\n test_get_posts_should_return_siblings (blog.tests.test_models.CategoryPageTest) ... OK (0.094s)\n test_get_search_content_index_blog_page_titles (blog.tests.test_search_content.TestBlogIndex) ... OK (0.050s)\n test_get_search_content_indexes_body (blog.tests.test_search_content.TestBlogIndex) ... OK (0.045s)\n test_get_search_content_indexes_title (blog.tests.test_search_content.TestBlogIndex) ... OK (0.046s)\n test_get_search_content_indexes_body (blog.tests.test_search_content.TestBlogPage) ... OK (0.048s)\n test_get_search_content_indexes_category_page_title (blog.tests.test_search_content.TestBlogPage) ... OK (0.046s)\n test_get_search_content_indexes_teaser_text (blog.tests.test_search_content.TestBlogPage) ... OK (0.045s)\n test_get_search_content_indexes_title (blog.tests.test_search_content.TestBlogPage) ... OK (0.044s)\n test_country_filtered_for_is_in_queryset (directory.tests.test_filters.DirectoryCountryFilterTest) ... OK (0.164s)\n test_country_not_filtered_for_is_not_in_queryset (directory.tests.test_filters.DirectoryCountryFilterTest) ... OK (0.156s)\n test_directory_does_not_return_instances_that_are_not_children (directory.tests.test_filters.DirectoryFilterTest) ... OK (0.121s)\n test_directory_returns_its_children (directory.tests.test_filters.DirectoryFilterTest) ... OK (0.115s)\n test_langauge_not_filtered_for_is_not_in_queryset (directory.tests.test_filters.DirectoryLanguageFilterTest) ... OK (0.163s)\n test_language_filtered_for_is_in_queryset (directory.tests.test_filters.DirectoryLanguageFilterTest) ... OK (0.155s)\n test_country_and_language_filter (directory.tests.test_filters.DirectoryMultipleFiltersTest) ... OK (0.249s)\n test_country_and_topic_filter (directory.tests.test_filters.DirectoryMultipleFiltersTest) ... OK (0.252s)\n test_title_not_searched_is_not_in_queryset (directory.tests.test_filters.DirectorySearchFilterTest) ... OK (0.123s)\n test_title_searched_is_in_queryset (directory.tests.test_filters.DirectorySearchFilterTest) ... OK (0.117s)\n test_topic_filtered_for_is_in_queryset (directory.tests.test_filters.DirectoryTopicFilterTest) ... OK (0.161s)\n test_topic_not_filtered_for_is_not_in_queryset (directory.tests.test_filters.DirectoryTopicFilterTest) ... OK (0.153s)\n test_correct_country_returned_from_querydict (directory.tests.test_filters.FiltersFromQueryDictTest) ... OK (0.023s)\n test_correct_language_returned_from_querydict (directory.tests.test_filters.FiltersFromQueryDictTest) ... OK (0.020s)\n test_correct_search_term_returned_from_querydict (directory.tests.test_filters.FiltersFromQueryDictTest) ... OK (0.017s)\n test_correct_topic_returned_from_querydict (directory.tests.test_filters.FiltersFromQueryDictTest) ... OK (0.020s)\n test_invalid_id_does_not_break_filters (directory.tests.test_filters.FiltersFromQueryDictTest) ... OK (0.018s)\n test_multiple_filters_returned_from_querydict (directory.tests.test_filters.FiltersFromQueryDictTest) ... OK (0.024s)\n test_non_int_id_does_not_break_filters (directory.tests.test_filters.FiltersFromQueryDictTest) ... OK (0.017s)\n test_logged_in_user_should_not_see_edit_on_unowned_pages (directory.tests.test_models_entries.DirectoryEntryAuthTest) ... OK (0.346s)\n test_logged_in_user_should_see_edit_on_owned_pages (directory.tests.test_models_entries.DirectoryEntryAuthTest) ... ERROR (0.135s)\n test_logged_out_user_should_not_see_edit (directory.tests.test_models_entries.DirectoryEntryAuthTest) ... OK (0.233s)\n test_get_search_content_indexes_countries (directory.tests.test_models_entries.DirectoryEntrySearchTest) ... OK (0.060s)\n test_get_search_content_indexes_description (directory.tests.test_models_entries.DirectoryEntrySearchTest) ... OK (0.047s)\n test_get_search_content_indexes_landing_page_url (directory.tests.test_models_entries.DirectoryEntrySearchTest) ... OK (0.048s)\n test_get_search_content_indexes_languages (directory.tests.test_models_entries.DirectoryEntrySearchTest) ... OK (0.050s)\n test_get_search_content_indexes_onion_address (directory.tests.test_models_entries.DirectoryEntrySearchTest) ... OK (0.048s)\n test_get_search_content_indexes_title (directory.tests.test_models_entries.DirectoryEntrySearchTest) ... OK (0.050s)\n test_get_search_content_indexes_topics (directory.tests.test_models_entries.DirectoryEntrySearchTest) ... OK (0.050s)\n test_duplicate_landing_pages_are_invalid (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.053s)\n test_returns_latest_live_result (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.060s)\n test_save_associates_results (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.066s)\n test_securedrop_can_save_expected_urls (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.057s)\n test_securedrop_cannot_save_empty_urls (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.004s)\n test_securedrop_cannot_save_invalid_onion_address (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.007s)\n test_securedrop_cannot_save_invalid_url (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.004s)\n test_securedrop_string_representation (directory.tests.test_models_entries.DirectoryEntryTest) ... OK (0.047s)\n test_a_down_instance_gets_a_null_grade (directory.tests.test_models_entries.ResultTest) ... OK (0.064s)\n test_an_instance_showing_server_software_in_headers_gets_a_D (directory.tests.test_models_entries.ResultTest) ... OK (0.060s)\n test_an_instance_showing_server_version_in_headers_gets_a_D (directory.tests.test_models_entries.ResultTest) ... OK (0.059s)\n test_an_instance_using_a_cdn_gets_a_D (directory.tests.test_models_entries.ResultTest) ... OK (0.060s)\n test_an_instance_using_a_subdomain_gets_a_D (directory.tests.test_models_entries.ResultTest) ... OK (0.059s)\n test_an_instance_using_cookies_gets_an_F (directory.tests.test_models_entries.ResultTest) ... OK (0.061s)\n test_an_instance_with_cache_control_nostore_not_set_gets_a_B (directory.tests.test_models_entries.ResultTest) ... OK (0.059s)\n test_an_instance_with_expires_not_set_gets_a_C (directory.tests.test_models_entries.ResultTest) ... OK (0.059s)\n test_grade_computed_on_save (directory.tests.test_models_entries.ResultTest) ... OK (0.058s)\n test_is_equal_to_compares_only_scan_attributes__new_result (directory.tests.test_models_entries.ResultTest) ... OK (0.057s)\n test_is_equal_to_compares_only_scan_attributes__same_result (directory.tests.test_models_entries.ResultTest)\nTest is_equal_to does not compare pk, _state, etc. ... OK (0.058s)\n test_result_string_representation (directory.tests.test_models_entries.ResultTest) ... OK (0.056s)\n test_save_associates_results (directory.tests.test_models_entries.ResultTest) ... OK (0.061s)\n test_securedrop_can_get_most_recent_scan (directory.tests.test_models_entries.ResultTest) ... OK (0.064s)\n test_domain_annotation (directory.tests.test_models_entries.SecuredropQuerySetTestCase) ... OK (0.049s)\n test_management_disabled_causes_404s (directory.tests.test_models_settings.DirectorySettingsTestCase) ... OK (0.112s)\n test_management_disabled_hides_call_to_action (directory.tests.test_models_settings.DirectorySettingsTestCase) ... OK (0.157s)\n test_management_enabled_shows_call_to_action (directory.tests.test_models_settings.DirectorySettingsTestCase) ... OK (0.248s)\n test_scan_disabled_hides_detail_scan_results (directory.tests.test_models_settings.DirectorySettingsTestCase) ... OK (0.178s)\n test_scan_disabled_hides_directory_scan_results (directory.tests.test_models_settings.DirectorySettingsTestCase) ... OK (0.161s)\n test_scan_enabled_shows_detail_scan_results (directory.tests.test_models_settings.DirectorySettingsTestCase) ... OK (0.184s)\n test_scan_enabled_shows_directory_scan_results (directory.tests.test_models_settings.DirectorySettingsTestCase) ... OK (0.167s)\n test_get_search_content_indexes_body (directory.tests.test_search_content.TestDirectoryPage) ... OK (0.022s)\n test_get_search_content_indexes_source_warning (directory.tests.test_search_content.TestDirectoryPage) ... OK (0.019s)\n test_get_search_content_indexes_title (directory.tests.test_search_content.TestDirectoryPage) ... OK (0.019s)\n test_render_scan_form (directory.tests.test_views.ScanViewTest) ... OK (0.039s)\n test_unauthenticated_scan (directory.tests.test_views.ScanViewTest) ... OK (0.043s)\n test_verified_scan (directory.tests.test_views.ScanViewTest) ... OK (0.186s)\n test_blank_request_fails (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.008s)\n test_ignore_non_release_events (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.006s)\n test_incorrect_secret (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.007s)\n test_incorrect_signature_due_to_payload (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.006s)\n test_incorrect_signature_format (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.006s)\n test_missing_data_in_release_fails (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.006s)\n test_non_published_action_value_ignored (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.006s)\n test_successful_release (github.tests.test_receive_hook.TestReceiveHook) ... OK (0.007s)\n test_bulk_scan (landing_page_checker.landing_page.tests.test_scanner.ScannerTest) ... OK (1.945s)\n test_bulk_scan_not_live (landing_page_checker.landing_page.tests.test_scanner.ScannerTest) ... OK (1.927s)\n test_request_gets_page_if_protocol_identifier_not_present (landing_page_checker.landing_page.tests.test_scanner.ScannerTest)\nrequest_and_scrape_page should handle a URL without a protocol ... OK (0.028s)\n test_request_gets_page_if_protocol_identifier_present (landing_page_checker.landing_page.tests.test_scanner.ScannerTest)\nrequest_and_scrape_page should handle a URL with a protocol ... OK (0.033s)\n test_scan_and_commit (landing_page_checker.landing_page.tests.test_scanner.ScannerTest) ... OK (1.558s)\n test_scan_and_no_commit (landing_page_checker.landing_page.tests.test_scanner.ScannerTest) ... OK (1.672s)\n test_scan_returns_result_if_site_live (landing_page_checker.landing_page.tests.test_scanner.ScannerTest) ... OK (1.487s)\n test_scan_returns_result_if_site_not_live (landing_page_checker.landing_page.tests.test_scanner.ScannerTest) ... OK (1.322s)\n test_cache_control_must_not_revalidate_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_must_revalidate_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_not_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_nocache_not_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_nocache_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_nostore_not_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_nostore_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_notransform_not_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_notransform_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_private_not_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cache_control_validate_private_set (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_clickjacking_protection_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_clickjacking_protection_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cloudflare_headers_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cloudflare_headers_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cross_domain_policy_not_set_properly (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_cross_domain_policy_set_properly (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_csp_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_csp_present_multiple_values (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest)\nCSP check should pass with multiple values as long as \"default-src 'self'\" is among them. ... OK (0.000s)\n test_csp_present_single_value (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_expires_header_disabling_caching (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_expires_header_not_disabling_caching (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_google_analytics_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_google_analytics_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_guardian_url_does_have_subdomain (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_guardian_url_does_not_have_protocol (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_no_download_option_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_no_download_option_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_nosniff_protection_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_nosniff_protection_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_onion_link_is_in_href (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.001s)\n test_onion_link_is_not_in_href (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.001s)\n test_pragma_header_disabling_caching (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_pragma_header_not_disabling_caching (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_server_header_software_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_server_header_software_present_apache (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_server_header_software_present_nginx (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_server_header_version_is_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_server_header_version_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_url_does_have_subdomain (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_url_does_not_have_subdomain (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_www_url_does_not_have_subdomain (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_xss_protection_not_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_xss_protection_present (landing_page_checker.landing_page.tests.test_validation.VerificationUtilityTest) ... OK (0.000s)\n test_validate_unique_title__invalid (landing_page_checker.tests.test_forms.DirectoryEntryFormTest) ... OK (0.004s)\n test_validate_unique_title__valid__different_instance (landing_page_checker.tests.test_forms.DirectoryEntryFormTest) ... OK (0.003s)\n test_validate_unique_title__valid__same_instance (landing_page_checker.tests.test_forms.DirectoryEntryFormTest) ... OK (0.010s)\n test_form_url_input_has_css_classes (landing_page_checker.tests.test_forms.LandingPageFormTest) ... OK (0.001s)\n test_form_validation (landing_page_checker.tests.test_forms.LandingPageFormTest) ... OK (0.000s)\n test_form_validation_for_blank_url (landing_page_checker.tests.test_forms.LandingPageFormTest) ... OK (0.000s)\n test_form_validation_for_not_a_url (landing_page_checker.tests.test_forms.LandingPageFormTest) ... OK (0.000s)\n test_not_sends_email__no_setting (landing_page_checker.tests.test_views.FormViewTest) ... OK (0.190s)\n test_not_sends_email__no_users (landing_page_checker.tests.test_views.FormViewTest) ... OK (0.189s)\n test_sends_email (landing_page_checker.tests.test_views.FormViewTest) ... OK (0.197s)\n test_get_connection_error (search.tests.test_discourse_client.DiscourseClientTestCase)\nDiscourse client should handle persistent connection failures ... OK (0.003s)\n test_get_connection_error_then_success (search.tests.test_discourse_client.DiscourseClientTestCase) ... OK (0.001s)\n test_get_with_exception (search.tests.test_discourse_client.DiscourseClientTestCase)\nDiscourse client should handle HTTP exceptions and return False ... OK (0.001s)\n test_successful_get (search.tests.test_discourse_client.DiscourseClientTestCase)\nDiscourse client should execute get requests successfully ... OK (0.001s)\n test_search (search.tests.test_search.SearchTestCase) ... OK (0.051s)\n test_created_document_content_should_be_stripped_posts (search.tests.test_search_documents_discourse.IndexTopicsTestCase) ... OK (0.006s)\n test_created_document_has_correct_url (search.tests.test_search_documents_discourse.IndexTopicsTestCase) ... OK (0.004s)\n test_created_document_has_created_at_metadata (search.tests.test_search_documents_discourse.IndexTopicsTestCase) ... OK (0.004s)\n test_created_document_has_posts_count_metadata (search.tests.test_search_documents_discourse.IndexTopicsTestCase) ... OK (0.004s)\n test_created_document_title_should_be_post_title (search.tests.test_search_documents_discourse.IndexTopicsTestCase) ... OK (0.004s)\n test_created_document_type_should_be_forum (search.tests.test_search_documents_discourse.IndexTopicsTestCase) ... OK (0.004s)\n test_created_document_content_should_be_stripped_posts_with_extras (search.tests.test_search_documents_discourse.IndexTopicsWithExtrasTestCase) ... OK (0.005s)\n test_fetching_sites_returns_list_of_urls (search.tests.test_search_documents_documentation.FetchPagesTestCase) ... OK (0.061s)\n test_should_update_pages_if_they_already_exist (search.tests.test_search_documents_documentation.IndexPagesTestCase) ... OK (0.006s)\n test_should_use_a_default_title_if_none_exists (search.tests.test_search_documents_documentation.IndexPagesTestCase) ... OK (0.003s)\n test_update_documentation_search_documents (search.tests.test_search_documents_documentation.UpdateDocumentationIndexTestCase) ... OK (3.060s)\n test_delete_unindexed_page (search.tests.test_search_documents_wagtail.WagtailTestCase) ... OK (0.022s)\n test_index_wagtail_page (search.tests.test_search_documents_wagtail.WagtailTestCase) ... OK (0.024s)\n test_index_wagtail_page_signal (search.tests.test_search_documents_wagtail.WagtailTestCase) ... OK (0.067s)\n test_indexed_page_should_have_correct_content (search.tests.test_search_documents_wagtail.WagtailTestCase) ... OK (0.036s)\n test_non_routable_wagtail_page (search.tests.test_search_documents_wagtail.WagtailTestCase) ... OK (0.018s)\n test_unindex_wagtail_page (search.tests.test_search_documents_wagtail.WagtailTestCase) ... OK (0.023s)\n test_unindex_wagtail_page_signal (search.tests.test_search_documents_wagtail.WagtailTestCase) ... OK (0.089s)\n test_flush_should_remove_all_documents_by_type (search.tests.test_utils.FlushTestCase) ... OK (0.006s)\n test_feed_has_correct_description (blog.tests.test_rss_feed.RSSTest) ... OK (0.222s)\n test_feed_has_correct_item_link (blog.tests.test_rss_feed.RSSTest) ... OK (0.267s)\n test_feed_has_correct_item_title (blog.tests.test_rss_feed.RSSTest) ... OK (0.271s)\n test_feed_has_correct_link (blog.tests.test_rss_feed.RSSTest) ... OK (0.259s)\n test_feed_has_correct_title (blog.tests.test_rss_feed.RSSTest) ... OK (0.266s)\n test_feed_has_posts (blog.tests.test_rss_feed.RSSTest) ... OK (0.266s)\n test_valid_rss_feed (blog.tests.test_rss_feed.RSSTest) ... OK (0.281s)\n test_url_to_domain_strips_path (landing_page_checker.tests.test_utils.URLToDomainTestCase) ... OK (0.000s)\n test_url_to_domain_strips_path_and_protocol (landing_page_checker.tests.test_utils.URLToDomainTestCase) ... OK (0.000s)\n test_url_to_domain_strips_protocol (landing_page_checker.tests.test_utils.URLToDomainTestCase) ... OK (0.000s)\n\n======================================================================\nERROR [0.135s]: test_logged_in_user_should_see_edit_on_owned_pages (directory.tests.test_models_entries.DirectoryEntryAuthTest)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/backends/utils.py\", line 64, in execute\n return self.cursor.execute(sql, params)\npsycopg2.IntegrityError: duplicate key value violates unique constraint \"directory_baseitem_title_key\"\nDETAIL: Key (title)=(Iusto.) already exists.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/var/www/django-alpha/directory/tests/test_models_entries.py\", line 254, in setUp\n self.user_owned_sd_page = DirectoryEntryFactory(live=True, parent=directory)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/factory/base.py\", line 46, in __call__\n return cls.create(**kwargs)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/factory/base.py\", line 568, in create\n return cls._generate(enums.CREATE_STRATEGY, kwargs)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/factory/base.py\", line 505, in _generate\n return step.build()\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/factory/builder.py\", line 293, in build\n context=postgen_context,\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/factory/declarations.py\", line 570, in call\n instance, create, context.value, **context.extra)\n File \"/var/www/django-alpha/directory/tests/factories/entry.py\", line 53, in countries\n country.save()\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/modelcluster/models.py\", line 203, in save\n super(ClusterableModel, self).save(update_fields=real_update_fields, **kwargs)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/base.py\", line 808, in save\n force_update=force_update, update_fields=update_fields)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/base.py\", line 837, in save_base\n self._save_parents(cls, using, update_fields)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/base.py\", line 864, in _save_parents\n self._save_table(cls=parent, using=using, update_fields=update_fields)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/base.py\", line 924, in _save_table\n result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/base.py\", line 963, in _do_insert\n using=using, raw=raw)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/manager.py\", line 85, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/query.py\", line 1076, in _insert\n return query.get_compiler(using=using).execute_sql(return_id)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/models/sql/compiler.py\", line 1112, in execute_sql\n cursor.execute(sql, params)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/backends/utils.py\", line 64, in execute\n return self.cursor.execute(sql, params)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/utils.py\", line 94, in __exit__\n six.reraise(dj_exc_type, dj_exc_value, traceback)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/utils/six.py\", line 685, in reraise\n raise value.with_traceback(tb)\n File \"/home/gcorn/securedrop-alpha/lib/python3.4/site-packages/django/db/backends/utils.py\", line 64, in execute\n return self.cursor.execute(sql, params)\ndjango.db.utils.IntegrityError: duplicate key value violates unique constraint \"directory_baseitem_title_key\"\nDETAIL: Key (title)=(Iusto.) already exists.\n\n\n----------------------------------------------------------------------\nRan 198 tests in 27.120s\n\nFAILED (errors=1)\n\nGenerating XML reports...\n", "stdout": "Using existing test database for alias 'default'...\nSystem check identified no issues (0 silenced).\nPreserving test database for alias 'default'...\n", "stdout_lines": ["Using existing test database for alias 'default'...", "System check identified no issues (0 silenced).", "Preserving test database for alias 'default'..."]} ...ignoring
harrislapiroff commented 6 years ago

I think the problem is compounded because of this setup:

Language, Country, and Topic (all taxonomy models for DirectoryEntrys) all inherit from a BaseItem model. BaseItem is not an abstract model, meaning that it uses Django's concrete inheritance—i.e., all three models get stored in the same database table. So when generating random data for testing if the same name is generated for both a Language and Country, for example, it will violate a uniqueness constraint.

A quick solution here would be to rewrite the test factories to generate names like Language 1, Language 2, Country 1, Country 2, etc. IMO a better solution would be to forego Django's concrete inheritance, make BaseItem an abstract model, and put Languages, Countrys, and Topics each in their own database table. Unfortunately, once again, this requires some non-trivial database migration...

harrislapiroff commented 6 years ago

I'm working on the latter solution on my scanner-restructure branch

harrislapiroff commented 6 years ago

I'm gonna call this resolved, based on #445, but if it crops up again we can reopen.