# ----------
# $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
# ---
test: multi_metadata_sync
test: multi_metadata_sync_domain
test: metadata_replay_security

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: pg16
test: pg18
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.
# ---------------------------------------------------------------------------------

# ----------
# ----------
# multi_unsupported_worker_operations tests that unsupported operations error out on metadata workers
# ----------
test: multi_unsupported_worker_operations

# Don't parallelize the following two tests as they directly alter pg_dist_shardid_seq
# on the coordinator and restore it at the end.
# Will be moved back to multi_1_schedule at Citus 15.
test: schema_based_sharding_from_workers_a
test: schema_based_sharding_from_workers_b

# ----------
# citus_cluster_changes_block tests UDFs introduced in 14.1; not present in the
# N-1 (14.0-1) extension, so 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: citus_cluster_changes_block

# ----------
# allow_unsafe_insert_select_pushdown exercises the citus.allow_unsafe_insert_select_pushdown
# GUC introduced in 14.2; not present in the N-1 (14.0-1) Citus binary, so the SET errors out
# and the plans fall back under N-1. 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: allow_unsafe_insert_select_pushdown

# ----------
# extract_deparse covers deparser behavior introduced in 14.3; not present in the
# N-1 (14.2-1) Citus binary. 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: extract_deparse

# ----------
# 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

# ----------
# ----------
# multi_orderby_pushdown covers sorted-merge planner and executor 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: multi_orderby_pushdown

# ----------
# adaptive_executor_batching exercises executor batching GUCs introduced in
# 14.3; they are not present in the N-1 (14.2-1) Citus 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: adaptive_executor_batching

# ----------
# multi_having_var_remapping covers a planner fix introduced in 14.3, absent from
# the N-1 (14.2.0) Citus binary. Keep these cases out of the N-1 test matrix;
# they remain part of multi_having_pushdown on main.
# ----------
test: multi_having_var_remapping

# ----------
# 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
