github.com/dolthub/go-mysql-server@v0.18.0/sql/mysql_db/replica_source_info_table_test.go (about)

     1  // Copyright 2023 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package mysql_db
    16  
    17  import "testing"
    18  
    19  func TestReplicaSourceInfoTableSchema(t *testing.T) {
    20  	// Each column has a constant index that it expects to match, therefore if a column's position is updated and the
    21  	// variable referencing it hasn't also been updated, this will throw a panic.
    22  	for i, col := range replicaSourceInfoTblSchema {
    23  		switch col.Name {
    24  		case "Number_of_lines":
    25  			if replicaSourceInfoTblColIndex_Number_of_lines != i {
    26  				t.FailNow()
    27  			}
    28  		case "Master_log_name":
    29  			if replicaSourceInfoTblColIndex_Master_log_name != i {
    30  				t.FailNow()
    31  			}
    32  		case "Master_log_pos":
    33  			if replicaSourceInfoTblColIndex_Master_log_pos != i {
    34  				t.FailNow()
    35  			}
    36  		case "Host":
    37  			if replicaSourceInfoTblColIndex_Host != i {
    38  				t.FailNow()
    39  			}
    40  		case "User_name":
    41  			if replicaSourceInfoTblColIndex_User_name != i {
    42  				t.FailNow()
    43  			}
    44  		case "User_password":
    45  			if replicaSourceInfoTblColIndex_User_password != i {
    46  				t.FailNow()
    47  			}
    48  		case "Port":
    49  			if replicaSourceInfoTblColIndex_Port != i {
    50  				t.FailNow()
    51  			}
    52  		case "Connect_retry":
    53  			if replicaSourceInfoTblColIndex_Connect_retry != i {
    54  				t.FailNow()
    55  			}
    56  		case "Enabled_ssl":
    57  			if replicaSourceInfoTblColIndex_Enabled_ssl != i {
    58  				t.FailNow()
    59  			}
    60  		case "Ssl_ca":
    61  			if replicaSourceInfoTblColIndex_Ssl_ca != i {
    62  				t.FailNow()
    63  			}
    64  		case "Ssl_capath":
    65  			if replicaSourceInfoTblColIndex_Ssl_capath != i {
    66  				t.FailNow()
    67  			}
    68  		case "Ssl_cert":
    69  			if replicaSourceInfoTblColIndex_Ssl_cert != i {
    70  				t.FailNow()
    71  			}
    72  		case "Ssl_cipher":
    73  			if replicaSourceInfoTblColIndex_Ssl_cipher != i {
    74  				t.FailNow()
    75  			}
    76  		case "Ssl_key":
    77  			if replicaSourceInfoTblColIndex_Ssl_key != i {
    78  				t.FailNow()
    79  			}
    80  		case "Ssl_verify_server_cert":
    81  			if replicaSourceInfoTblColIndex_Ssl_verify_server_cert != i {
    82  				t.FailNow()
    83  			}
    84  		case "Heartbeat":
    85  			if replicaSourceInfoTblColIndex_Heartbeat != i {
    86  				t.FailNow()
    87  			}
    88  		case "Bind":
    89  			if replicaSourceInfoTblColIndex_Bind != i {
    90  				t.FailNow()
    91  			}
    92  		case "Ignored_server_ids":
    93  			if replicaSourceInfoTblColIndex_Ignored_server_ids != i {
    94  				t.FailNow()
    95  			}
    96  		case "Uuid":
    97  			if replicaSourceInfoTblColIndex_Uuid != i {
    98  				t.FailNow()
    99  			}
   100  		case "Retry_count":
   101  			if replicaSourceInfoTblColIndex_Retry_count != i {
   102  				t.FailNow()
   103  			}
   104  		case "Ssl_crl":
   105  			if replicaSourceInfoTblColIndex_Ssl_crl != i {
   106  				t.FailNow()
   107  			}
   108  		case "Ssl_crlpath":
   109  			if replicaSourceInfoTblColIndex_Ssl_crlpath != i {
   110  				t.FailNow()
   111  			}
   112  		case "Enabled_auto_position":
   113  			if replicaSourceInfoTblColIndex_Enabled_auto_position != i {
   114  				t.FailNow()
   115  			}
   116  		case "Channel_name":
   117  			if replicaSourceInfoTblColIndex_Channel_name != i {
   118  				t.FailNow()
   119  			}
   120  		case "Tls_version":
   121  			if replicaSourceInfoTblColIndex_Tls_version != i {
   122  				t.FailNow()
   123  			}
   124  		case "Public_key_path":
   125  			if replicaSourceInfoTblColIndex_Public_key_path != i {
   126  				t.FailNow()
   127  			}
   128  		case "Get_public_key":
   129  			if replicaSourceInfoTblColIndex_Get_public_key != i {
   130  				t.FailNow()
   131  			}
   132  		case "Network_namespace":
   133  			if replicaSourceInfoTblColIndex_Network_namespace != i {
   134  				t.FailNow()
   135  			}
   136  		case "Master_compression_algorithm":
   137  			if replicaSourceInfoTblColIndex_Master_compression_algorithm != i {
   138  				t.FailNow()
   139  			}
   140  		case "Master_zstd_compression_level":
   141  			if replicaSourceInfoTblColIndex_Master_zstd_compression_level != i {
   142  				t.FailNow()
   143  			}
   144  		case "Tls_ciphersuites":
   145  			if replicaSourceInfoTblColIndex_Tls_ciphersuites != i {
   146  				t.FailNow()
   147  			}
   148  		case "Source_connection_auto_failover":
   149  			if replicaSourceInfoTblColIndex_Source_connection_auto_failover != i {
   150  				t.FailNow()
   151  			}
   152  		case "Gtid_only":
   153  			if replicaSourceInfoTblColIndex_Gtid_only != i {
   154  				t.FailNow()
   155  			}
   156  		default:
   157  			t.Errorf(`col "%s" does not have a constant`, col.Name)
   158  		}
   159  	}
   160  }