# ----------
# $Id$
#
# Regression tests that create/drop the Citus extension in the regression database.
# This schedule includes both prerequisites these tests depend on and downstream tests that depend on them.
# These tests are separated from multi_1_schedule so that the tests remain in there
# do not change the version of the citus extension in regression database.
#
# Also the tests that assume a clean start after extension creation are moved here.
#
# ----------

# ---
# Tests around extension creation / upgrades.
# ---
test: multi_extension
test: multi_test_helpers multi_test_helpers_superuser
test: multi_cluster_management
test: multi_create_fdw

# ---
# Prerequisites for multi_metadata_sync (from citus_tests/run_test.py)
# Tests need a clean start, such as multi_read_from_secondaries
# ---
test: alter_role_propagation
test: multi_test_catalog_views
test: multi_table_ddl
test: multi_sequence_default
test: multi_read_from_secondaries
test: alter_database_propagation

# ----------
# multi_replicate_reference_table tests replicating reference tables to new nodes after we add new nodes
# multi_remove_node_reference_table tests metadata changes after master_remove_node
# ----------
test: multi_replicate_reference_table
test: multi_remove_node_reference_table

# ----------
# Test for tenant statistics
# ----------
test: citus_stat_tenants

test: multi_modifying_xacts
test: multi_transaction_recovery

# ---
# multi_drop_extension makes sure we can safely drop and recreate the extension.
# ---
test: multi_drop_extension

# ---
# multi_metadata_sync tests the propagation of mx-related metadata changes to metadata workers.
# multi_metadata_sync_domain tests that metadata sync works correctly with DOMAIN types in non-public schemas
# metadata_sync_batching and metadata_sync_batching_edge_cases test that metadata sync works correctly while
# periodically flushing the caches and batching the metadata into set-based statements
# ---
test: multi_metadata_sync
test: multi_metadata_sync_domain
test: metadata_replay_security
test: metadata_sync_batching
test: metadata_sync_batching_edge_cases

test: grant_on_function_propagation
test: grant_on_foreign_server_propagation

# ----------
# grant_on_schema_propagation tests if the GRANT ... ON SCHEMA queries are propagated correctly
# multi_schema_support makes sure we can work with tables in schemas other than public with no problem
# ----------
test: grant_on_schema_propagation
test: multi_schema_support


# ----------
# multi_colocation_utils tests utility functions written for co-location feature & internal API
# ----------
test: multi_colocation_utils

test: coordinator_shouldhaveshards
test: mx_regular_user

# ----------
# multi_multiuser tests simple combinations of permission access and queries
# ----------
test: multi_multiuser

# Don't parallelize stat_counters with others because we don't want statistics
# to be updated by other tests concurrently except Citus Maintenance Daemon.
#
# Also, this needs to be the first test that calls citus_stat_counters()
# because it checks the value of stats_reset column before calling the function.
test: stat_counters

test: function_propagation
test: force_search_path_in_execute
test: citus_internal_distribute_object
test: drop_database
test: extract_deparse
test: pg16
test: pg18
test: pg19
test: multi_transaction_recovery_multiple_databases

# Have this placeholder section at the end for the tests that need to be moved back
# to their original schedules with the next major version of Citus are listed below.
#
# These tests are kept here to prevent N-1 test failures for the features that are
# not present in the minor version.
# ---------------------------------------------------------------------------------

# ----------
# non_var_group_by covers planner behavior introduced in 14.3; not present in
# the N-1 (14.2-1) coordinator library. Run it only under
# check-multi-1-create-citus, which is not part of the N-1 test matrix. Move
# back to multi_schedule at Citus 15.
# ----------
test: non_var_group_by

# ----------
# multi_or_arm_pruning covers planner behavior introduced in 14.3; not present
# in the N-1 (14.2-1) coordinator library. Run it only under
# check-multi-1-create-citus, which is not part of the N-1 test matrix. Move
# back to multi_1_schedule at Citus 15.
# ----------
test: multi_or_arm_pruning

# ----------
# node_removal_transaction_recovery covers node removal behavior introduced in
# 14.3; not present in the N-1 (14.2-1) coordinator library. Run it only under
# check-multi-1-create-citus, which is not part of the N-1 test matrix.
# ----------
test: node_removal_transaction_recovery

# ----------
# insert_select_single_shard_table_8959 covers an INSERT ... SELECT crash
# (#8959) fixed in 14.3; the N-1 (14.2-1) coordinator library still segfaults
# or produces invalid worker SQL on these statements, so this cannot run under
# the N-1 test matrix. Move back to multi_1_schedule at Citus 15.
# ----------
test: insert_select_single_shard_table_8959

# ----------
# update_subscript_fetch_8987 covers an UPDATE .. SET crash (#8987); the N-1
# (14.2-1) coordinator library still segfaults on these statements, so this
# cannot run under the N-1 test matrix. Move to multi_schedule, next to
# subscripting_op, once the N-1 coordinator library has the fix.
# ----------
test: update_subscript_fetch_8987

# ----------
# insert_typmod_routing covers routing INSERTs by the distribution column
# value after the column's typmod is applied. The N-1 coordinator library
# routes a constant value before the typmod is applied, so this cannot run
# under the N-1 test matrix. Move to multi_1_schedule once the N-1 library has
# the fix.
# ----------
test: insert_typmod_routing

# ----------
# shard_move_after_modifications covers shard transfers after modifications in
# the same transaction, which the N-1 (14.2-1) coordinator library lets through;
# a move via logical replication then waits forever, so this cannot run under
# the N-1 test matrix. Move back to operations_schedule at Citus 15.
# ----------
test: shard_move_after_modifications
