--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
let $engine_type=NDBCLUSTER;

connection slave;
set @saved_slave_type_conversions = @@global.slave_type_conversions;
CREATE TABLE type_conversions (
       TestNo INT AUTO_INCREMENT PRIMARY KEY,
       Source TEXT,
       Target TEXT,
       Flags TEXT,
       On_Master TEXT,
       On_Slave TEXT,
       Expected TEXT,
       Compare INT,
       Error TEXT);

SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
SELECT @@global.slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
SELECT @@global.slave_type_conversions;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
SELECT @@global.slave_type_conversions;

# Checking non-lossy integer type conversions
connection slave;
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
source extra/rpl_tests/type_conversions.test;

connection slave;
--source suite/rpl_ndb/t/check_conversions.inc

DROP TABLE type_conversions;

--disable_query_log
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* Error_code: 1677");
--enable_query_log

connection master;
DROP TABLE t1;
sync_slave_with_master;

set global slave_type_conversions = @saved_slave_type_conversions;

--source include/rpl_end.inc

