Skip to content

Commit

Permalink
only test v2+
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Aug 30, 2024
1 parent 332b6c7 commit 9a69f9e
Showing 1 changed file with 24 additions and 184 deletions.
208 changes: 24 additions & 184 deletions test/plausible/release_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,30 @@ defmodule Plausible.ReleaseTest do
:ok
end

test "from scratch" do
defp fake_migrate(repo, up_to_migration) do
{up_to_version, _name} = Integer.parse(up_to_migration)

Ecto.Migrator.with_repo(repo, fn repo ->
schema_versions =
Ecto.Migrator.migrations(repo)
|> Enum.filter(fn {status, version, _name} ->
status == :down and version <= up_to_version
end)
|> Enum.map(fn {_status, version, _name} ->
{version, NaiveDateTime.utc_now(:second)}
end)

repo.insert_all("schema_versions", schema_versions)
end)
end

test "v2.0.0 -> master" do

Check failure on line 109 in test/plausible/release_test.exs

View workflow job for this annotation

GitHub Actions / Build and test (ce_test, postgres:16)

test pending_streaks/1 v2.0.0 -> master (Plausible.ReleaseTest)
# pretend to migrate the repos up to v2.0.0
# https://github.com/plausible/analytics/tree/v2.0.0/priv/repo/migrations
fake_migrate(PostgreSQL, _up_to = "20230516131041_add_unique_index_to_api_keys")
# https://github.com/plausible/analytics/tree/v2.0.0/priv/ingest_repo/migrations
fake_migrate(ClickHouse, _up_to = "20230509124919_clean_up_old_tables_after_v2_migration")

pending_streaks = capture_io(fn -> Release.pending_streaks([PostgreSQL, ClickHouse]) end)

pending_streaks =
Expand All @@ -106,190 +129,7 @@ defmodule Plausible.ReleaseTest do
Starting repos..
Collecting pending migrations..
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20200619071221:
* 20181201181549_add_pageviews
* 20181214201821_add_new_visitor_to_pageviews
* 20181215140923_add_session_id_to_pageviews
* 20190109173917_create_sites
* 20190117135714_add_uid_to_pageviews
* 20190118154210_add_derived_data_to_pageviews
* 20190126135857_add_name_to_users
* 20190127213938_add_tz_to_sites
* 20190205165931_add_last_seen_to_users
* 20190213224404_add_intro_emails
* 20190219130809_delete_intro_emails_when_user_is_deleted
* 20190301122344_add_country_code_to_pageviews
* 20190324155606_add_password_hash_to_users
* 20190402145007_remove_device_type_from_pageviews
* 20190402145357_remove_screen_height_from_pageviews
* 20190402172423_add_index_to_pageviews
* 20190410095248_add_feedback_emails
* 20190424162903_delete_feedback_emails_when_user_is_deleted
* 20190430140411_use_citext_for_email
* 20190430152923_create_subscriptions
* 20190516113517_remove_session_id_from_pageviews
* 20190520144229_change_user_id_to_uuid
* 20190523160838_add_raw_referrer
* 20190523171519_add_indices_to_referrers
* 20190618165016_add_public_sites
* 20190718160353_create_google_search_console_integration
* 20190723141824_associate_google_auth_with_site
* 20190730014913_add_monthly_stats
* 20190730142200_add_weekly_stats
* 20190730144413_add_daily_stats
* 20190809174105_calc_screen_size
* 20190810145419_remove_unused_indices
* 20190820140747_remove_rollup_tables
* 20190906111810_add_email_reporting
* 20190907134114_add_unique_index_to_email_settings
* 20190910120900_add_email_address_to_settings
* 20190911102027_add_monthly_reports
* 20191010031425_add_property_to_google_auth
* 20191015072730_remove_unused_fields
* 20191015073507_proper_timestamp_for_pageviews
* 20191024062200_rename_pageviews_to_events
* 20191025055334_add_name_to_events
* 20191031051340_add_goals
* 20191031063001_remove_goal_name
* 20191118075359_allow_free_subscriptions
* 20191216064647_add_unique_index_to_email_reports
* 20191218082207_add_sessions
* 20191220042658_add_session_start
* 20200106090739_cascade_google_auth_deletion
* 20200107095234_add_entry_page_to_sessions
* 20200113143927_add_exit_page_to_session
* 20200114131538_add_tweets
* 20200120091134_change_session_referrer_to_text
* 20200121091251_add_recipients
* 20200122150130_add_shared_links
* 20200130123049_add_site_id_to_events
* 20200204093801_rename_site_id_to_domain
* 20200204133522_drop_events_hostname_index
* 20200210134612_add_fingerprint_to_events
* 20200211080841_add_raw_fingerprint
* 20200211090126_remove_raw_fingerprint
* 20200211133829_add_initial_source_and_referrer_to_events
* 20200219124314_create_custom_domains
* 20200227092821_add_fingerprint_sesssions
* 20200302105632_flexible_fingerprint_referrer
* 20200317093028_add_trial_expiry_to_users
* 20200317142459_backfill_fingerprints
* 20200320100803_add_setup_emails
* 20200323083536_add_create_site_emails
* 20200323084954_add_check_stats_emails
* 20200324132431_make_cookie_fields_non_required
* 20200406115153_cascade_custom_domain_deletion
* 20200408122329_cascade_setup_emails_deletion
* 20200529071028_add_oban_jobs_table
* 20200605134616_remove_events_and_sessions
* 20200605142737_remove_fingerprint_sessions_table
* 20200619071221_create_salts_table
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20201106125234:
* 20200915070607_create_events_and_sessions
* 20200918075025_add_utm_tags
* 20201020083739_add_event_metadata
* 20201106125234_add_browser_version_and_os_version
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20210209095257:
* 20201130083829_add_email_verification_codes
* 20201208173543_add_spike_notifications
* 20201210085345_add_email_verified_to_users
* 20201214072008_add_theme_pref_to_users
* 20201230085939_delete_email_records_when_user_is_deleted
* 20210115092331_cascade_site_deletion_to_spike_notification
* 20210119093337_add_unique_index_to_spike_notification
* 20210128083453_cascade_site_deletion
* 20210128084657_create_api_keys
* 20210209095257_add_last_payment_details
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20210323130440:
* 20210323130440_add_sample_by
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20210629124428:
* 20210406073254_add_name_to_shared_links
* 20210409074413_add_unique_index_to_shared_link_name
* 20210409082603_add_api_key_scopes
* 20210420075623_add_sent_renewal_notifications
* 20210426075157_upgrade_oban_jobs_to_v9
* 20210513091653_add_currency_to_subscription
* 20210525085655_add_rate_limit_to_api_keys
* 20210531080158_add_role_to_site_memberships
* 20210601090924_add_invitations
* 20210604085943_add_locked_to_sites
* 20210629124428_cascade_site_deletion_to_invitations
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20210712214034:
* 20210712214034_add_more_location_details
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20210908081119:
* 20210726090211_make_invitation_email_case_insensitive
* 20210906102736_memoize_setup_complete
* 20210908081119_allow_trial_expiry_to_be_null
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20211017093035:
* 20211017093035_add_utm_content_and_term
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20211110174617:
* 20211020093238_add_enterprise_plans
* 20211022084427_add_site_limit_to_enterprise_plans
* 20211028122202_grace_period_end
* 20211110174617_add_site_imported_source
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20211112130238:
* 20211112130238_create_imported_tables
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20211202094732:
* 20211202094732_remove_tweets
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20220404123000:
* 20220310104931_add_transferred_from
* 20220404123000_add_entry_props_to_session
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20220421074114:
* 20220405124819_add_stats_start_date
* 20220408071645_create_oban_peers
* 20220408080058_swap_primary_oban_indexes
* 20220421074114_create_feature_flags_table
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20220422075510:
* 20220421161259_remove_entry_props
* 20220422075510_add_entry_props
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20221228123226:
* 20221109082503_add_rate_limiting_to_sites
* 20221123104203_index_updated_at_for_sites
* 20221228123226_cascade_delete_sent_renewal_notifications
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20230214114402:
* 20230124140348_add_city_name_to_imported_locations
* 20230210140348_remove_city_name_to_imported_locations
* 20230214114402_create_ingest_counters_table
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20230301095227:
* 20230301095227_add_native_stats_start_date
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20230320094327:
* 20230320094327_create_v2_schemas
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20230417095029:
* 20230328062644_allow_domain_change
* 20230406110926_associate-goals-with-sites
* 20230410070312_fixup_goals_sites_assoc
* 20230417092745_add_monetary_value_to_goals
* 20230417095029_init_funnels
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20230417104025:
* 20230417104025_add_revenue_to_events
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20230503094245:
* 20230503094245_add_event_prop_allowlist_to_site
Plausible.ReleaseTest.ClickHouse [_build/test/lib/plausible/priv/ingest_repo/migrations] streak up to version 20230509124919:
* 20230509124919_clean_up_old_tables_after_v2_migration
Plausible.ReleaseTest.PostgreSQL [_build/test/lib/plausible/priv/repo/migrations] streak up to version 20231011101825:
* 20230516131041_add_unique_index_to_api_keys
* 20230530161856_add_enable_feature_fields_for_site
* 20230724131709_change_allowed_event_props_type
* 20230802081520_cascade_delete_user
Expand Down

0 comments on commit 9a69f9e

Please sign in to comment.