Skip to content

Commit

Permalink
cluster/import: add test of enable_binlog on importing
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis committed Aug 24, 2020
1 parent c2a25dd commit 20fdc0d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/cluster/ansible/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func parseInventoryFile(invFile io.Reader) (string, *spec.ClusterMeta, *aini.Inv
}

if enableBinlog, err := strconv.ParseBool(grp.Vars["enable_binlog"]); err == nil && enableBinlog {
if clsMeta.Topology.ServerConfigs.TiDB == nil {
clsMeta.Topology.ServerConfigs.TiDB = make(map[string]interface{})
}
clsMeta.Topology.ServerConfigs.TiDB["binlog.enable"] = enableBinlog
}
} else {
Expand Down
10 changes: 10 additions & 0 deletions pkg/cluster/ansible/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ func (s *ansSuite) TestParseInventoryFile(c *C) {
monitored:
deploy_dir: /home/tiopsimport/ansible-deploy
data_dir: /home/tiopsimport/ansible-deploy/data
server_configs:
tidb:
binlog.enable: true
tikv: {}
pd: {}
tiflash: {}
tiflash-learner: {}
pump: {}
drainer: {}
cdc: {}
tidb_servers: []
tikv_servers: []
tiflash_servers: []
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/ansible/test-data/inventory.ini
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ enable_ntpd = True
set_hostname = True

## binlog trigger
enable_binlog = False
enable_binlog = True

# kafka cluster address for monitoring, example:
# kafka_addrs = "192.168.0.11:9092,192.168.0.12:9092,192.168.0.13:9092"
Expand Down
10 changes: 10 additions & 0 deletions pkg/cluster/ansible/test-data/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ topology:
deploy_dir: /home/tiopsimport/ansible-deploy
data_dir: /home/tiopsimport/ansible-deploy/data
log_dir: /home/tiopsimport/ansible-deploy/log
server_configs:
tidb:
binlog.enable: true
tikv: {}
pd: {}
tiflash: {}
tiflash-learner: {}
pump: {}
drainer: {}
cdc: {}
tidb_servers:
- host: 172.16.1.218
ssh_port: 9999
Expand Down

0 comments on commit 20fdc0d

Please sign in to comment.