From d552eaf9591269ea30adfbda8b6c59ab674dd265 Mon Sep 17 00:00:00 2001 From: secwall Date: Tue, 26 Nov 2024 19:18:44 +0100 Subject: [PATCH] Fix some minor typos --- internal/app/app.go | 6 +++--- internal/app/data.go | 2 +- internal/mysql/node.go | 2 +- internal/mysql/switch_helper.go | 2 +- internal/util/util.go | 2 +- tests/features/failover.feature | 6 +++--- tests/features/host_management.feature | 4 ++-- tests/features/readonly_filesystem.feature | 2 +- tests/features/repair.feature | 2 +- tests/features/switchover_from.feature | 2 +- tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj | 2 +- tests/mysync_test.go | 6 +++--- tests/testutil/docker_composer.go | 8 ++++---- tests/testutil/matchers/matchers.go | 2 +- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index e85f0b72..92435978 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -764,7 +764,7 @@ func (app *App) approveFailover(clusterState, clusterStateDcs map[string]*NodeSt app.logger.Infof("approve failover: filesystem is readonly, skip replication and delay checks") } else { if countRunningHASlaves(clusterState) == countHANodes(clusterState)-1 { - return fmt.Errorf("all replics are alive and running replication, seems zk problems") + return fmt.Errorf("all replicas are alive and running replication, seems zk problems") } if app.config.FailoverDelay > 0 { failingTime := time.Since(app.nodeFailedAt[master]) @@ -880,7 +880,7 @@ func (app *App) calcActiveNodes(clusterState, clusterStateDcs map[string]*NodeSt } if !node.PingOk { if node.PingDubious || clusterStateDcs[host].PingOk { - // we can't rely on ping and slave status if ping was dubios + // we can't rely on ping and slave status if ping was dubious if util.ContainsString(oldActiveNodes, host) { app.logger.Warnf("calc active nodes: %s is dubious or keep health lock in dcs, keeping active...", host) activeNodes = append(activeNodes, host) @@ -1408,7 +1408,7 @@ func (app *App) performSwitchover(clusterState map[string]*NodeState, activeNode app.logger.Infof("switchover: old master %s does not need recovery", oldMaster) err = app.externalReplication.Reset(oldMasterNode) if err != nil { - return fmt.Errorf("got error: %s while reseting external replication on old master: %s", err, oldMaster) + return fmt.Errorf("got error: %s while resetting external replication on old master: %s", err, oldMaster) } } diff --git a/internal/app/data.go b/internal/app/data.go index c9b2a7cd..941fbfd0 100644 --- a/internal/app/data.go +++ b/internal/app/data.go @@ -270,7 +270,7 @@ type SemiSyncState struct { const ( // CauseManual means switchover was issued via command line CauseManual = "manual" - // CauseWorker means switchover was initated via MDB worker (set directly to dcs) + // CauseWorker means switchover was initiated via MDB worker (set directly to dcs) CauseWorker = "worker" // CauseAuto means failover was started automatically by failure detection process CauseAuto = "auto" diff --git a/internal/mysql/node.go b/internal/mysql/node.go index ef9dd742..29149ca0 100644 --- a/internal/mysql/node.go +++ b/internal/mysql/node.go @@ -308,7 +308,7 @@ func Mogrify(query string, arg map[string]interface{}) string { }) } -// not all queries may be parametrized with placeholders +// not all queries may be parameterized with placeholders func (n *Node) execMogrifyWithTimeout(queryName string, arg map[string]interface{}, timeout time.Duration) error { query := n.getQuery(queryName) query = Mogrify(query, arg) diff --git a/internal/mysql/switch_helper.go b/internal/mysql/switch_helper.go index 11d53881..5cfe2e4b 100644 --- a/internal/mysql/switch_helper.go +++ b/internal/mysql/switch_helper.go @@ -62,7 +62,7 @@ func (sh *SwitchHelper) CheckFailoverQuorum(activeNodes []string, permissibleSla if sh.SemiSync { failoverQuorum := sh.GetFailoverQuorum(activeNodes) if permissibleSlaves < failoverQuorum { - return fmt.Errorf("no quorum, have %d replics while %d is required", permissibleSlaves, failoverQuorum) + return fmt.Errorf("no quorum, have %d replicas while %d is required", permissibleSlaves, failoverQuorum) } } else { if permissibleSlaves == 0 { diff --git a/internal/util/util.go b/internal/util/util.go index b32d7c87..a39aef5f 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -21,7 +21,7 @@ func GetEnvVariable(name, def string) string { } // SelectNode returns host (from given list) starting specified match string -// If match starts with ^ it's discareded (backward compatibility) +// If match starts with ^ it's discarded (backward compatibility) func SelectNodes(hosts []string, match string) []string { match = strings.TrimPrefix(match, "^") res := make([]string, 0) diff --git a/tests/features/failover.feature b/tests/features/failover.feature index 37818db1..51cd1eeb 100644 --- a/tests/features/failover.feature +++ b/tests/features/failover.feature @@ -82,7 +82,7 @@ Feature: failover And mysql on host "mysql2" is killed Then mysql host "mysql1" should become unavailable within "10" seconds And mysql host "mysql2" should become unavailable within "10" seconds - # give a change to perform (actualy not) failover + # give a change to perform (actually not) failover When I wait for "30" seconds Then mysql host "mysql3" should be replica of "{{.master}}" And zookeeper node "/test/master" should match regexp @@ -102,7 +102,7 @@ Feature: failover .*failover was not approved:.*no quorum.* """ - Scenario: failover works well with dymanic quorum + Scenario: failover works well with dynamic quorum Given cluster environment is """ MYSYNC_FAILOVER=true @@ -193,7 +193,7 @@ Feature: failover When host "{{.new_master}}" is stopped Then mysql host "{{.new_master}}" should become unavailable within "10" seconds - # give a change to perform (actualy not) failover + # give a change to perform (actually not) failover When I wait for "30" seconds Then mysql host "mysql1" should be replica of "{{.new_master}}" And mysql host "{{.old_slave}}" should be replica of "{{.new_master}}" diff --git a/tests/features/host_management.feature b/tests/features/host_management.feature index ca5b7b22..2862aa01 100644 --- a/tests/features/host_management.feature +++ b/tests/features/host_management.feature @@ -46,13 +46,13 @@ Feature: update host topology using CLI Then zookeeper node "/test/ha_nodes/mysql2" should not exist Then zookeeper node "/test/cascade_nodes/mysql2" should exist - # loops are forbiden: + # loops are forbidden: When I run command on host "mysql1" """ mysync host add mysql2 --stream-from mysql2 """ Then command return code should be "1" - # loops are forbiden: + # loops are forbidden: When I run command on host "mysql1" """ mysync host add mysql1 --stream-from mysql2 diff --git a/tests/features/readonly_filesystem.feature b/tests/features/readonly_filesystem.feature index 3911e013..989b77b3 100644 --- a/tests/features/readonly_filesystem.feature +++ b/tests/features/readonly_filesystem.feature @@ -1,5 +1,5 @@ Feature: readonly filesystem - Scenario: check master failture when disk on muster become readonly + Scenario: check master failure when disk on muster become readonly Given cluster environment is """ MYSYNC_FAILOVER=true diff --git a/tests/features/repair.feature b/tests/features/repair.feature index dfe8d2ea..272ff751 100644 --- a/tests/features/repair.feature +++ b/tests/features/repair.feature @@ -108,7 +108,7 @@ Feature: repair hosts in cluster Given cluster is up and running Then mysql host "mysql1" should be master And mysql host "mysql1" should be writable - # jsut to have stable tests - turn on maintenance mode + # just to have stable tests - turn on maintenance mode And I run command on host "mysql1" """ mysync maint on diff --git a/tests/features/switchover_from.feature b/tests/features/switchover_from.feature index 1686d1b0..12a49d95 100644 --- a/tests/features/switchover_from.feature +++ b/tests/features/switchover_from.feature @@ -32,7 +32,7 @@ Feature: manual switchover from old master "initiated_by": "mysql1", "result": { "ok": false, - "error": "no quorum, have 0 replics while 2 is required" + "error": "no quorum, have 0 replicas while 2 is required" } } """ diff --git a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj index 1567b5e3..d96bc047 100644 --- a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj +++ b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj @@ -245,7 +245,7 @@ (let [master (clojure.string/replace (String. (get (zk/data client "/test/master") :data)) #"\"" "") node (rand-nth (filter (fn [x] (not (string/includes? (name x) "zookeeper"))) (:nodes test)))] - (info (str "runnning switchover from " master)) + (info (str "running switchover from " master)) (control/on node (control/exec :mysync :switch :--from master)))) (catch Throwable t# diff --git a/tests/mysync_test.go b/tests/mysync_test.go index 64184aec..cc56276c 100644 --- a/tests/mysync_test.go +++ b/tests/mysync_test.go @@ -704,7 +704,7 @@ func (tctx *testContext) stepSetReadonlyStatus(host string, value string) error cmd := fmt.Sprintf("rm /tmp/readonly && echo %s > /tmp/readonly", value) code, output, err := tctx.composer.RunCommand(host, cmd, commandExecutionTimeout) if code != 0 { - return fmt.Errorf("comand exit with code %d and output: %s", code, output) + return fmt.Errorf("command exit with code %d and output: %s", code, output) } return err } @@ -1286,7 +1286,7 @@ func (tctx *testContext) stepMysqlHostShouldBecomeWritableWithin(host string, ti return err } -func (tctx *testContext) stepISaveZookeperQueryResultAs(varname string) error { +func (tctx *testContext) stepISaveZookeeperQueryResultAs(varname string) error { var j interface{} if tctx.zkQueryResult != "" { if err := json.Unmarshal([]byte(tctx.zkQueryResult), &j); err != nil { @@ -1465,7 +1465,7 @@ func InitializeScenario(s *godog.ScenarioContext) { s.Step(`^I have no SQL execution error at mysql host "([^"]*)" within "(\d+)" seconds$`, tctx.stepThereIsNoSQLErrorWithin) // variables - s.Step(`^I save zookeeper query result as "([^"]*)"$`, tctx.stepISaveZookeperQueryResultAs) + s.Step(`^I save zookeeper query result as "([^"]*)"$`, tctx.stepISaveZookeeperQueryResultAs) s.Step(`^I save command output as "([^"]*)"$`, tctx.stepISaveCommandOutputAs) s.Step(`^I save SQL result as "([^"]*)"$`, tctx.stepISaveSQLResultAs) s.Step(`^I save "([^"]*)" as "([^"]*)"$`, tctx.stepISaveValAs) diff --git a/tests/testutil/docker_composer.go b/tests/testutil/docker_composer.go index a0411760..abf5e937 100644 --- a/tests/testutil/docker_composer.go +++ b/tests/testutil/docker_composer.go @@ -39,9 +39,9 @@ type Composer interface { Stop(service string) error // Starts container/VM Start(service string) error - // Detachs container/VM from network + // Detaches container/VM from network DetachFromNet(service string) error - // Attachs container/VM to network + // Attaches container/VM to network AttachToNet(service string) error // Executes command inside container/VM with given timeout. // Returns command retcode and output (stdoud and stderr are mixed) @@ -249,7 +249,7 @@ func (dc *DockerComposer) RunAsyncCommand(service string, cmd string) error { return dc.api.ContainerExecStart(context.Background(), execResp.ID, container.ExecStartOptions{}) } -// GetFile returns content of the fail from continer by path +// GetFile returns content of the fail from container by path func (dc *DockerComposer) GetFile(service, path string) (io.ReadCloser, error) { cont, ok := dc.containers[service] if !ok { @@ -308,7 +308,7 @@ func (dc *DockerComposer) Stop(service string) error { return err } -// AttachToNet attachs container to network +// AttachToNet attaches container to network func (dc *DockerComposer) AttachToNet(service string) error { _, ok := dc.containers[service] if !ok { diff --git a/tests/testutil/matchers/matchers.go b/tests/testutil/matchers/matchers.go index 341c7158..d10a9724 100644 --- a/tests/testutil/matchers/matchers.go +++ b/tests/testutil/matchers/matchers.go @@ -154,7 +154,7 @@ func JSONExactlyMatcher(actual string, expected string) error { return nil } -// GetMatcher returns registred matcher by name +// GetMatcher returns registered matcher by name func GetMatcher(name string) (Matcher, error) { if matcher, ok := registry[name]; ok { return matcher, nil