diff --git a/.cspell-precommit.json b/.cspell-precommit.json deleted file mode 100644 index ff0ab263e..000000000 --- a/.cspell-precommit.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", - "import": [ - "@cspell/dict-ru_ru/cspell-ext.json", - ], - "language": "en,ru", - "dictionaryDefinitions": [ - { - "name": "project-words", - "path": ".cspell_project-words.txt", - "description": "Words used in this project", - "addWords": true - } - ], - "dictionaries": [ - "project-words" - ] -} diff --git a/.cspell.yaml b/.cspell.yaml new file mode 100644 index 000000000..af94cf1d7 --- /dev/null +++ b/.cspell.yaml @@ -0,0 +1,32 @@ +$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json +version: 0.2 + +import: + - "@cspell/dict-golang/cspell-ext.json" + - "@cspell/dict-python/cspell-ext.json" + - "@cspell/dict-lua/cspell-ext.json" + - "@cspell/dict-cpp/cspell-ext.json" + - "@cspell/dict-markdown/cspell-ext.json" + - "@cspell/dict-ru_ru/cspell-ext.json" + - "@cspell/dict-software-terms/cspell-ext.json" + +language: "en,ru" + +dictionaryDefinitions: + - name: project-words + path: .cspell_project-words.txt + description: Words used in this project + addWords: true + +dictionaries: + - project-words + # List of type dependent dictionaries to use with any file types. + - golang + - python + - lua + - cpp + +ignoreRegExpList: + - ^\s+(\w+\s+)?"github.com/.*" # Ignore Go import paths. + - -D[A-Z\d_]+ # Ignore CMake flags "-DFLAG_NAME". + - \d+-g[a-f\d]{4,} # Ignore git commit hashes in version string. diff --git a/.cspell_project-words.txt b/.cspell_project-words.txt index 937c9dd15..b59c32312 100644 --- a/.cspell_project-words.txt +++ b/.cspell_project-words.txt @@ -1,48 +1,68 @@ -catridge -cli -coredump -distfiles -dpkg -etcdctl +*cmd* ++cli ++ctl ++s +addfinalizer +aeon* +autoexpel +bootstrapper +ccluster +clientv3 +clustercmd +commentf +containsf +debugf +demoter +disbalance +distfile* +drwxr +equalf +errf +etcd* +etcdserver evaler -getenv +falsef +finalizer* +flightrec +getfixturevalue golangci -Infof -iproto -isort -logfile +incdir +infof +leaderuuid +libcluster +luabody +luajit +luakit luarocks -MAKEFLAGS mapstructure memtx -myapp -packignore -pidfile -postinst -preinst +mvcc +mvccpb +nilf +nodeps +nogc +nolint +notarantool +promptui protoc -pytest rebootstrap -replicaset -replicasets -rocks -rockspec +replicaset* +rockspec* +rpmdeb +specialchars sslcafile -sslcertfile sslciphers -sslkeyfile stateboard -Svacer -tarantool -tarantoolctl -tarantools -tcm -testdata -testfull -TNTP -ttable -venv +svacer +tarantool* +tlsdialer +tmpl +tnt+ +tntp +trimprefix +truef vshard -Warnf -xlog -xlogs +vylog +warnf +xcall +xlog* diff --git a/.github/actions/static-code-check/action.yml b/.github/actions/static-code-check/action.yml index 01e3120ab..c501c07cc 100644 --- a/.github/actions/static-code-check/action.yml +++ b/.github/actions/static-code-check/action.yml @@ -25,12 +25,12 @@ runs: echo "Found base branch with hash: '${HASH}'" echo "BASE_BRANCH=${HASH}" >> ${GITHUB_ENV} - - name: pre-commit checks (diff) - uses: pre-commit/action@v3.0.1 - env: - SKIP: golangci-lint-full - with: - extra_args: --all-files --from-ref=${{ env.BASE_BRANCH }} --to-ref=HEAD --hook-stage=manual + # - name: pre-commit checks (diff) + # uses: pre-commit/action@v3.0.1 + # env: + # SKIP: golangci-lint-full + # with: + # extra_args: --all-files --from-ref=${{ env.BASE_BRANCH }} --to-ref=HEAD --hook-stage=manual - name: pre-commit checks (full) uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1d02e959d..daa76b8d2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,47 +23,40 @@ repos: files: ".cspell_project-words.txt" args: [--ignore-case, --unique] - - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 - hooks: - - id: codespell - name: "Check for common misspellings" - stages: [pre-commit, manual] - types_or: [go, python, lua] - additional_dependencies: - - tomli - - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v9.0.1 + rev: v9.1.0 hooks: - id: cspell - name: "Spell-checking documentation files" - stages: [pre-commit, manual] - args: - [--config=.cspell-precommit.json, --show-context, --show-suggestions] - types_or: [markdown] + name: "Spell checking commit message" + stages: [commit-msg] + args: [--config=.cspell.yaml, --show-context, --show-suggestions] additional_dependencies: - "@cspell/dict-markdown" - "@cspell/dict-ru_ru" + - "@cspell/dict-golang" + - "@cspell/dict-python" + - "@cspell/dict-lua" + - "@cspell/dict-cpp" + - "@cspell/dict-software-terms" - id: cspell - name: "Spell-checking commit message" - stages: [commit-msg] - args: - [--config=.cspell-precommit.json, --show-context, --show-suggestions] + name: "Spell checking source files" + stages: [pre-commit, manual] + args: [--config=.cspell.yaml, --show-context, --show-suggestions] + types_or: [go, python, markdown] + exclude: | + (?x)^( + .*\.pb.go| + .*/third_party/.* + )$ additional_dependencies: + - "@cspell/dict-markdown" - "@cspell/dict-ru_ru" - # TODO: add words from [.go, .py] with "errors" to `.cspell_project-words.txt` (#TNTP-3105). - # - id: cspell - # name: "Py: Spell check files" - # types: [python] - # additional_dependencies: - # - "@cspell/dict-python" - # - id: cspell - # name: "Go: Spell check files" - # types: [go] - # additional_dependencies: - # - "@cspell/dict-golang" + - "@cspell/dict-golang" + - "@cspell/dict-python" + - "@cspell/dict-lua" + - "@cspell/dict-cpp" + - "@cspell/dict-software-terms" - repo: local hooks: @@ -88,7 +81,7 @@ repos: args: [--max-len=100, --tab-len=4, --no-reformat-tags] - repo: https://github.com/golangci/golangci-lint - rev: v2.1.6 + rev: v2.2.2 hooks: - id: golangci-lint name: "Go: verify sources" @@ -102,7 +95,6 @@ repos: - id: golangci-lint-full name: "Go: verify all sources (CI)" description: Checking all Go sources. - pass_filenames: false always_run: true stages: [manual] args: [--config=golint-precommit-ci.yml, --allow-parallel-runners] @@ -113,8 +105,8 @@ repos: language: golang types: [go] name: "Go: verify sources diff (CI)" + description: Checking only fresh changes, added to the PR. stages: [manual] - pass_filenames: false always_run: true entry: >- bash -c "golangci-lint run --new-from-rev=${BASE_BRANCH:-master} @@ -123,16 +115,16 @@ repos: - github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.0 + rev: v0.12.2 hooks: - - id: ruff-check - name: "Py: Run the linter" - args: [--fix] + - id: ruff-format + name: "Py: Run the formatter" stages: [pre-commit, manual] files: test/.*\.py$ - - id: ruff-format - name: "Py: Run the formatter" + - id: ruff-check + name: "Py: Run the linter" + args: [--fix] stages: [pre-commit, manual] files: test/.*\.py$ diff --git a/CHANGELOG.md b/CHANGELOG.md index 441df1dd3..f6c8a873f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -781,7 +781,7 @@ Additionally, several fixes were implemented to improve stability. ### Changed -- Modules `tt start`, `tt connect` and `tt catridge` now use relative +- Modules `tt start`, `tt connect` and `tt cartridge` now use relative paths for unix sockets. It allows to use socket paths longer than sun_path limit.(108/106 on linux/macOS) e.g foo/bar.sock -> ./bar.sock diff --git a/cli/binary/switch.go b/cli/binary/switch.go index b414e95dd..819d62b67 100644 --- a/cli/binary/switch.go +++ b/cli/binary/switch.go @@ -29,10 +29,13 @@ type SwitchCtx struct { Version string } +// spell-checker:disable // ansi is a string to clean strings from ANSI escape codes using regexp. const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;" + "[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))" +// spell-checker:enable + func cleanString(str string) string { re := regexp.MustCompile(ansi) return re.ReplaceAllString(str, "") diff --git a/cli/checkpoint/checkpoint.go b/cli/checkpoint/checkpoint.go index 96dfc0966..60fe4e542 100644 --- a/cli/checkpoint/checkpoint.go +++ b/cli/checkpoint/checkpoint.go @@ -47,9 +47,9 @@ func Cat(tntCli cmdcontext.TarantoolCli) error { // Play is playing the contents of .snap/.xlog files to another Tarantool instance. // Returns an error if such occur during playing. func Play(tntCli cmdcontext.TarantoolCli) error { - var errbuff bytes.Buffer + var errBuff bytes.Buffer cmd := exec.Command(tntCli.Executable, "-") - cmd.Stderr = &errbuff + cmd.Stderr = &errBuff stdoutPipe, err := cmd.StdoutPipe() if err != nil { @@ -63,7 +63,7 @@ func Play(tntCli cmdcontext.TarantoolCli) error { stdinPipe.Close() if err := cmd.Start(); err != nil { - return fmt.Errorf("result of play: %s", errbuff.String()) + return fmt.Errorf("result of play: %s", errBuff.String()) } scanner := bufio.NewScanner(stdoutPipe) @@ -73,8 +73,8 @@ func Play(tntCli cmdcontext.TarantoolCli) error { } cmd.Wait() - if len(errbuff.String()) > 0 { - return fmt.Errorf("result of play: %s", errbuff.String()) + if len(errBuff.String()) > 0 { + return fmt.Errorf("result of play: %s", errBuff.String()) } return nil diff --git a/cli/cluster/cmd/publish.go b/cli/cluster/cmd/publish.go index b55ade5b0..324ad768a 100644 --- a/cli/cluster/cmd/publish.go +++ b/cli/cluster/cmd/publish.go @@ -7,7 +7,7 @@ import ( "github.com/tarantool/tt/lib/connect" ) -// PublishCtx contains information abould cluster publish command execution +// PublishCtx contains information about cluster publish command execution // context. type PublishCtx struct { // Username defines a username for connection. diff --git a/cli/cluster/integration_test.go b/cli/cluster/integration_test.go index 57c33ee8f..ee2042ef4 100644 --- a/cli/cluster/integration_test.go +++ b/cli/cluster/integration_test.go @@ -21,6 +21,8 @@ import ( libcluster "github.com/tarantool/tt/lib/cluster" ) +// spell-checker:ignore etcdmode etcddir etcdapp + const timeout = 5 * time.Second type etcdOpts struct { @@ -40,7 +42,7 @@ func doWithCtx(action func(context.Context) error) error { func startEtcd(t *testing.T, opts etcdOpts) integration.LazyCluster { t.Helper() - mydir, err := os.Getwd() + myDir, err := os.Getwd() if err != nil { t.Fatalf("Failed to get current working directory: %s", err) } @@ -49,15 +51,15 @@ func startEtcd(t *testing.T, opts etcdOpts) integration.LazyCluster { if opts.CaFile != "" || opts.CertFile != "" || opts.KeyFile != "" { tls = &transport.TLSInfo{} if opts.CaFile != "" { - caPath := filepath.Join(mydir, opts.CaFile) + caPath := filepath.Join(myDir, opts.CaFile) tls.TrustedCAFile = caPath } if opts.CertFile != "" { - certPath := filepath.Join(mydir, opts.CertFile) + certPath := filepath.Join(myDir, opts.CertFile) tls.CertFile = certPath } if opts.KeyFile != "" { - keyPath := filepath.Join(mydir, opts.KeyFile) + keyPath := filepath.Join(myDir, opts.KeyFile) tls.KeyFile = keyPath } } @@ -121,15 +123,15 @@ func startEtcd(t *testing.T, opts etcdOpts) integration.LazyCluster { func etcdPut(t *testing.T, etcd *clientv3.Client, key, value string) { t.Helper() var ( - presp *clientv3.PutResponse + pResp *clientv3.PutResponse err error ) doWithCtx(func(ctx context.Context) error { - presp, err = etcd.Put(ctx, key, value) + pResp, err = etcd.Put(ctx, key, value) return nil }) require.NoError(t, err) - require.NotNil(t, presp) + require.NotNil(t, pResp) } func etcdGet(t *testing.T, etcd *clientv3.Client, key string) ([]byte, int64) { diff --git a/cli/cmd/aeon.go b/cli/cmd/aeon.go index 8942da10b..d37505b0f 100644 --- a/cli/cmd/aeon.go +++ b/cli/cmd/aeon.go @@ -27,7 +27,7 @@ const ( aeonHistoryLines = console.DefaultHistoryLines ) -var aoenHelp = libconnect.MakeURLHelp(map[string]any{ +var aeonHelp = libconnect.MakeURLHelp(map[string]any{ "service": "etcd or tarantool config storage", "param_key": "a target configuration key in the prefix", "param_name": "a name of an instance in the cluster configuration", @@ -48,7 +48,7 @@ func newAeonConnectCmd() *cobra.Command { tt aeon connect unix:// tt aeon connect /path/to/config INSTANCE_NAME tt aeon connect https://user:pass@localhost:2379/prefix INSTANCE` + "\n\n" + - aoenHelp, + aeonHelp, PreRunE: func(cmd *cobra.Command, args []string) error { err := aeonConnectValidateArgs(cmd, args) util.HandleCmdErr(cmd, err) diff --git a/cli/cmd/cartridge.go b/cli/cmd/cartridge.go index c2f714dc0..b24c3d5aa 100644 --- a/cli/cmd/cartridge.go +++ b/cli/cmd/cartridge.go @@ -34,7 +34,7 @@ func generateRunDirForCartridge(env config.TtEnvOpts, configDir, runDir, appName return util.JoinAbspath(env.InstancesEnabled, appName, runDir) } -// NewCartridgeCmd chains commands from cartridge-cli to our corba tree. +// NewCartridgeCmd chains commands from cartridge-cli to our cobra tree. func NewCartridgeCmd() *cobra.Command { cartridgeCmd := &cobra.Command{ Use: "cartridge", diff --git a/cli/cmd/check.go b/cli/cmd/check.go index 82f4cb8d8..9f2b2a920 100644 --- a/cli/cmd/check.go +++ b/cli/cmd/check.go @@ -30,7 +30,7 @@ func internalCheckModule(cmdCtx *cmdcontext.CmdCtx, args []string) error { return err } - // Сollect a list of instances with unique scripts. + // Collect a list of instances with unique scripts. uniqueInst := []running.InstanceCtx{} for _, inst := range runningCtx.Instances { found := false diff --git a/cli/cmd/create_test.go b/cli/cmd/create_test.go index c29db49f6..1c94e8a2b 100644 --- a/cli/cmd/create_test.go +++ b/cli/cmd/create_test.go @@ -28,14 +28,14 @@ func TestCreateValidArgsFunction(t *testing.T) { }() os.Create(tempsDir1 + "/" + "excess.A") os.Create(tempsDir1 + "/" + "archive.tgz") - tdir1, _ := os.MkdirTemp(tempsDir1, "template1") + tDir1, _ := os.MkdirTemp(tempsDir1, "template1") os.Create(tempsDir2 + "/" + "excess.B") os.Create(tempsDir2 + "/" + "template2.tar.gz") - tdir2, _ := os.MkdirTemp(tempsDir2, "template2") + tDir2, _ := os.MkdirTemp(tempsDir2, "template2") - _, tdir1Name := filepath.Split(tdir1) - _, tdir2Name := filepath.Split(tdir2) + _, tDir1Name := filepath.Split(tDir1) + _, tDir2Name := filepath.Split(tDir2) templates := []string{ "cartridge", @@ -44,8 +44,8 @@ func TestCreateValidArgsFunction(t *testing.T) { "config_storage", "archive", "template2", - tdir1Name, - tdir2Name, + tDir1Name, + tDir2Name, } t.Run("empty args", func(t *testing.T) { diff --git a/cli/cmd/enable.go b/cli/cmd/enable.go index b2344182b..304711a0d 100644 --- a/cli/cmd/enable.go +++ b/cli/cmd/enable.go @@ -17,9 +17,9 @@ func NewEnableCmd() *cobra.Command { "to a script or an application directory", Example: ` # Create a symbolic link in 'instances_enabled' directory to a script. - $ tt enable Users/myuser/my_scripts/script.lua + $ tt enable Users/my_user/my_scripts/script.lua # Create a symbolic link in 'instances_enabled' directory to an application directory. - $ tt enable ../myuser/my_cool_app`, + $ tt enable ../my_user/my_cool_app`, Run: RunModuleFunc(internalEnableModule), Args: func(cmd *cobra.Command, args []string) error { if len(args) != 1 { diff --git a/cli/cmd/help.go b/cli/cmd/help.go index 0058d76ba..1fe56b5ad 100644 --- a/cli/cmd/help.go +++ b/cli/cmd/help.go @@ -54,6 +54,8 @@ func getExternalCommandsString(modulesInfo *modules.ModulesInfo) string { return "" } +// spell-checker:ignore rpad + var usageTemplate = util.Bold("USAGE") + ` {{- if (and .Runnable .HasAvailableInheritedFlags)}} {{.UseLine}} diff --git a/cli/cmd/replicaset.go b/cli/cmd/replicaset.go index 53acfb759..0c9601245 100644 --- a/cli/cmd/replicaset.go +++ b/cli/cmd/replicaset.go @@ -333,7 +333,7 @@ func newRolesRemoveCmd() *cobra.Command { cmd.Flags().StringVarP(&replicasetReplicasetName, "replicaset", "r", "", "name of a target replicaset") cmd.Flags().StringVarP(&replicasetGroupName, "group", "g", "", - "name of a target group (vhsard-group in the Cartridge case)") + "name of a target group (vshard-group in the Cartridge case)") cmd.Flags().StringVarP(&replicasetInstanceName, "instance", "i", "", "name of a target instance") cmd.Flags().BoolVarP(&replicasetIsGlobal, "global", "G", false, @@ -726,7 +726,7 @@ func internalReplicasetBootstrapModule(cmdCtx *cmdcontext.CmdCtx, args []string) if ctx.IsInstanceConnect { defer ctx.Conn.Close() } - bootstrapCtx := replicasetcmd.BootstapCtx{ + bootstrapCtx := replicasetcmd.BootstrapCtx{ ReplicasetsFile: replicasetCartridgeReplicasetsFile, Orchestrator: ctx.Orchestrator, RunningCtx: ctx.RunningCtx, @@ -741,7 +741,7 @@ func internalReplicasetBootstrapModule(cmdCtx *cmdcontext.CmdCtx, args []string) return replicasetcmd.Bootstrap(bootstrapCtx) } -// getOrchestartor returns a chosen orchestrator or an unknown one. +// getOrchestrator returns a chosen orchestrator or an unknown one. func getOrchestrator() (replicaset.Orchestrator, error) { orchestrator := replicaset.OrchestratorUnknown cnt := 0 diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 5b134c4bf..48ed37618 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -113,13 +113,13 @@ type logErrorWriterDecorator struct { // Write decorates the original output in the same way as log.Error. func (d logErrorWriterDecorator) Write(p []byte) (int, error) { // Setup LogHandler to write to string to get the decorated string. - var logdst strings.Builder - orig := d.handler.setWriter(&logdst) + var logDst strings.Builder + orig := d.handler.setWriter(&logDst) log.Errorf(string(p)) // Restore LogHandler with the original writer. d.handler.setWriter(orig) // Send the decorated data. - return fmt.Fprint(d.writer, logdst.String()) + return fmt.Fprint(d.writer, logDst.String()) } // NewCmdRoot creates a new root command. @@ -218,7 +218,7 @@ After that tt will be able to manage the application using 'replicaset_example' panic(err.Error()) } - // Adjust logger color mapping (display errors with hi-intencity color and bold). + // Adjust logger color mapping (display errors with hi-intensity color and bold). cli.Colors[log.ErrorLevel] = color.New(color.Bold, color.FgHiRed) cli.Colors[log.FatalLevel] = color.New(color.Bold, color.FgHiRed) diff --git a/cli/cmdcontext/cmdcontext.go b/cli/cmdcontext/cmdcontext.go index 91e8dacfc..b584e9f2d 100644 --- a/cli/cmdcontext/cmdcontext.go +++ b/cli/cmdcontext/cmdcontext.go @@ -112,7 +112,7 @@ type CliCtx struct { Verbose bool // TarantoolCli is current tarantool cli. TarantoolCli TarantoolCli - // Tcmcli is current tcm cli. + // TcmCli is current tcm cli. TcmCli TcmCli // IntegrityCheck is a public key used for integrity check. IntegrityCheck string diff --git a/cli/cmdcontext/cmdcontext_test.go b/cli/cmdcontext/cmdcontext_test.go index d647cb0a8..b4138295b 100644 --- a/cli/cmdcontext/cmdcontext_test.go +++ b/cli/cmdcontext/cmdcontext_test.go @@ -39,7 +39,7 @@ echo "Tarantool 3.0.0"`), require.NoError(t, err) require.Equal(t, expectedVersion, tntVersion) - // Check non-chached. + // Check non-cached. tntCli = TarantoolCli{Executable: filepath.Join(tmpDir, "tnt.sh")} tntVersion, err = tntCli.GetVersion() require.NoError(t, err) diff --git a/cli/configure/configure_test.go b/cli/configure/configure_test.go index 529276afa..9f8ee234b 100644 --- a/cli/configure/configure_test.go +++ b/cli/configure/configure_test.go @@ -67,7 +67,7 @@ func TestConfigureCli(t *testing.T) { testDir := t.TempDir() - // Test local cofniguration. + // Test local configuration. cmdCtx.Cli.IsSystem = false cmdCtx.Cli.LocalLaunchDir = testDir cmdCtx.Cli.ConfigPath = "" diff --git a/cli/connect/console.go b/cli/connect/console.go index 519325191..750b0aea3 100644 --- a/cli/connect/console.go +++ b/cli/connect/console.go @@ -280,7 +280,7 @@ func getExecutor(console *Console, connectCtx ConnectCtx) (func(string), error) console.livePrefixEnabled = false } - signalable_executor := func(in string) { + signaller_executor := func(in string) { // Signal handler. handleSignals := func(console *Console, stop chan struct{}) { sig := make(chan os.Signal, 1) @@ -300,7 +300,7 @@ func getExecutor(console *Console, connectCtx ConnectCtx) (func(string), error) stop <- struct{}{} } - return signalable_executor, nil + return signaller_executor, nil } func getCompleter(console *Console, connectCtx ConnectCtx) prompt.Completer { diff --git a/cli/connect/const.go b/cli/connect/const.go index 2005d381a..105862fc3 100644 --- a/cli/connect/const.go +++ b/cli/connect/const.go @@ -22,7 +22,7 @@ const setTableColumnWidthMaxLong = "\\set table_column_width" // setDelimiter set a custom expression delimiter for Tarantool console. const setDelimiter = "\\set delimiter" -// setTableColumnWidthMaxShort is a short command to set a maximum columnt +// setTableColumnWidthMaxShort is a short command to set a maximum columns // width for tables. const setTableColumnWidthMaxShort = "\\xw" @@ -42,11 +42,11 @@ const setFormatTable = "\\xt" const setFormatTTable = "\\xT" // setGraphicsEnable is a command to enable a pseudo graphics output for -// table/ttalbe output formats. +// table/ttable output formats. const setGraphicsEnable = "\\xG" // setGraphicsDisable is a command to disable a pseudo graphics output for -// table/ttalbe output formats. +// table/ttable output formats. const setGraphicsDisable = "\\xg" // setQuit is a short command to set ttable format. diff --git a/cli/connect/input_test.go b/cli/connect/input_test.go index 462cf4da2..2abebeda9 100644 --- a/cli/connect/input_test.go +++ b/cli/connect/input_test.go @@ -29,7 +29,7 @@ func TestLuaValidator_Close_multipleTimes(t *testing.T) { assert.NoError(t, s.Close()) } -func TestLuaValidator_Validate_aferClose(t *testing.T) { +func TestLuaValidator_Validate_afterClose(t *testing.T) { s := NewLuaValidator() s.Close() assert.Panics(t, func() { s.Validate("any string") }) diff --git a/cli/connect/language_test.go b/cli/connect/language_test.go index d54dc07d8..4cf0f3567 100644 --- a/cli/connect/language_test.go +++ b/cli/connect/language_test.go @@ -28,7 +28,7 @@ func TestLanguage_ParseLanguage(t *testing.T) { {"SQL", SQLLanguage, true}, {".", DefaultLanguage, false}, {"12", DefaultLanguage, false}, - {"luaasd", DefaultLanguage, false}, + {"luaasd", DefaultLanguage, false}, // spell-checker:ignore luaasd {"lua123", DefaultLanguage, false}, } diff --git a/cli/connector/binary.go b/cli/connector/binary.go index 3bb3a2349..6dc86c73d 100644 --- a/cli/connector/binary.go +++ b/cli/connector/binary.go @@ -63,7 +63,7 @@ func (conn *BinaryConnector) Eval(expr string, args []interface{}, } } - // Get responseonse. + // Get response once. if opts.ResData != nil { err = future.GetTyped(opts.ResData) } else { diff --git a/cli/connector/eval_plain_text.go b/cli/connector/eval_plain_text.go index 671963db9..f4294ff1e 100644 --- a/cli/connector/eval_plain_text.go +++ b/cli/connector/eval_plain_text.go @@ -226,7 +226,7 @@ func readDataPortionFromPlainTextConn(conn net.Conn, buffer *bytes.Buffer, // this greatly speeds up reading and responsiveness. // // But, due to the peculiarities of `box.session.push()`, we have to process the - // data byte by byte - we use HasPrefix and HasSufix merhods. + // data byte by byte - we use HasPrefix and HasSuffix methods. // // In addition, when reading in portion (more than 1 byte), we need // to save the read data (for this we use the bytes.Buffer), since we can read it, diff --git a/cli/connector/integration_test.go b/cli/connector/integration_test.go index 2c4bfb296..27b438de2 100644 --- a/cli/connector/integration_test.go +++ b/cli/connector/integration_test.go @@ -259,7 +259,7 @@ var poolCases = []struct { Opts: []ConnectOpts{ { Network: "tcp", - Address: "unreachetable", + Address: "unreachable", Username: "test", Password: "password", }, diff --git a/cli/connector/pool_test.go b/cli/connector/pool_test.go index 3fddbd79d..c6c4df048 100644 --- a/cli/connector/pool_test.go +++ b/cli/connector/pool_test.go @@ -15,10 +15,10 @@ func TestConnectPool_failed_to_connect(t *testing.T) { }{ {"nil", nil}, {"empty", []connector.ConnectOpts{}}, - {"unreachetable", []connector.ConnectOpts{ + {"unreachable", []connector.ConnectOpts{ { Network: connector.TCPNetwork, - Address: "unreachetable", + Address: "unreachable", }, }}, } diff --git a/cli/connector/protocol_test.go b/cli/connector/protocol_test.go index 8e3ba345b..ffdbdb25b 100644 --- a/cli/connector/protocol_test.go +++ b/cli/connector/protocol_test.go @@ -48,6 +48,7 @@ func (stub *greetingReadStub) Read(dst []byte) (int, error) { } func TestGetProtocol(t *testing.T) { + // spell-checker:ignore asdasdasd asdasdasdqwe err := errors.New("any error") cases := []struct { greeting string diff --git a/cli/coredump/coredump.go b/cli/coredump/coredump.go index e69f85be0..abf7c4647 100644 --- a/cli/coredump/coredump.go +++ b/cli/coredump/coredump.go @@ -16,13 +16,13 @@ import ( ) //go:embed scripts/* -var corescripts embed.FS +var coreScripts embed.FS //go:embed extensions var extensions embed.FS const ( - packEmbedPath = "scripts/tarabrt.sh" + packEmbedPath = "scripts/tarabrt.sh" // spell-checker:disable-line inspectEmbedPath = "scripts/gdb.sh" ) @@ -47,7 +47,7 @@ func Pack(corePath, executable, outputDir string, pid uint, time string) error { // Prepare gdb wrapper for packing. inspectPath := filepath.Join(tmpDir, filepath.Base(inspectEmbedPath)) - err = util.FsCopyFileChangePerms(corescripts, inspectEmbedPath, inspectPath, 0o755) + err = util.FsCopyFileChangePerms(coreScripts, inspectEmbedPath, inspectPath, 0o755) if err != nil { return fmt.Errorf("failed to put the inspecting script into the archive: %v", err) } @@ -69,7 +69,7 @@ func Pack(corePath, executable, outputDir string, pid uint, time string) error { scriptArgs = append(scriptArgs, "-x", extDst) } - script, err := corescripts.Open(packEmbedPath) + script, err := coreScripts.Open(packEmbedPath) if err != nil { return fmt.Errorf("failed to open pack script: %v", err) } @@ -131,7 +131,7 @@ func Inspect(archiveOrDir, sourceDir string) error { _, err = os.Stat(scriptPath) if errors.Is(err, fs.ErrNotExist) { // If the wrapper is missing in archive, then use the embedded one. - err = util.FsCopyFileChangePerms(corescripts, inspectEmbedPath, scriptPath, 0o755) + err = util.FsCopyFileChangePerms(coreScripts, inspectEmbedPath, scriptPath, 0o755) } if err != nil { diff --git a/cli/coredump/extensions/.cspell.yaml b/cli/coredump/extensions/.cspell.yaml new file mode 100644 index 000000000..54d9e14df --- /dev/null +++ b/cli/coredump/extensions/.cspell.yaml @@ -0,0 +1,70 @@ +$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json +version: "0.2" +ignoreWords: + - binl + - chunkname + - coro + - decdpun + - decinf + - decnan + - decneg + - decnumdigits + - decnummaxe + - decnumunits + - decpminus + - decpminusalt + - decpowers + - decsnan + - decspecial + - dualnum + - executinig + - extl + - frname + - ftsz + - gclen + - gclistlen + - gcnext + - gcptr + - gcref + - gcringlen + - gcval + - gcvmask + - glref + - grayagain + - hmask + - hnode + - hpart + - islua + - ispcall + - lfunc + - libluajit + - lightud + - lightudlo + - lightudseg + - ljgc + - lsms + - lstate + - luap + - memeq + - mmudata + - mslab + - msudigits + - nextgc + - notu + - pcallh + - prevd + - prevl + - snprint + - stepmul + - streq + - strl + - sweepstr + - sweepstring + - tisnum + - tlightud + - tnumx + - tudata + - tvislightud + - vdbe + - vmstate + - xrow diff --git a/cli/create/internal/app_template/manifest_test.go b/cli/create/internal/app_template/manifest_test.go index 7af9d8c30..7a027d4e5 100644 --- a/cli/create/internal/app_template/manifest_test.go +++ b/cli/create/internal/app_template/manifest_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" ) -type manifesLoadOutput struct { +type manifestLoadOutput struct { manifest TemplateManifest errMsg string } @@ -21,7 +21,7 @@ func TestLoadManifest(t *testing.T) { "missing_var_prompt.yaml", "non_existing.yaml", } - output := map[string]manifesLoadOutput{ + output := map[string]manifestLoadOutput{ "good_manifest.yaml": { TemplateManifest{ Description: "Good template", diff --git a/cli/create/internal/steps/collect_template_vars_test.go b/cli/create/internal/steps/collect_template_vars_test.go index d21a28c26..bbd9213b3 100644 --- a/cli/create/internal/steps/collect_template_vars_test.go +++ b/cli/create/internal/steps/collect_template_vars_test.go @@ -10,6 +10,8 @@ import ( "github.com/tarantool/tt/cli/create/internal/app_template" ) +// spell-checker:ignore zxzc + func TestNonInteractiveMode(t *testing.T) { var createCtx create_ctx.CreateCtx templateCtx := app_template.NewTemplateContext() diff --git a/cli/create/internal/steps/fill_template_vars_from_cli.go b/cli/create/internal/steps/fill_template_vars_from_cli.go index 22927828d..8eeca16b4 100644 --- a/cli/create/internal/steps/fill_template_vars_from_cli.go +++ b/cli/create/internal/steps/fill_template_vars_from_cli.go @@ -13,8 +13,8 @@ const varDefFormatError = `wrong variable definition format: %s Format: var-name=value` func parseVarDefinition(varDefText string) (struct{ name, value string }, error) { - varDefiniton := strings.TrimSpace(strings.TrimSuffix(varDefText, "\n")) - varName, value, found := strings.Cut(varDefiniton, "=") + varDefinition := strings.TrimSpace(strings.TrimSuffix(varDefText, "\n")) + varName, value, found := strings.Cut(varDefinition, "=") if !found || varName == "" || value == "" { return struct{ name, value string }{}, fmt.Errorf(varDefFormatError, varDefText) } @@ -28,8 +28,8 @@ type FillTemplateVarsFromCli struct{} func (FillTemplateVarsFromCli) Run(createCtx *create_ctx.CreateCtx, templateCtx *app_template.TemplateCtx, ) error { - for _, varDefiniton := range createCtx.VarsFromCli { - varDef, err := parseVarDefinition(varDefiniton) + for _, varDefinition := range createCtx.VarsFromCli { + varDef, err := parseVarDefinition(varDefinition) if err != nil { return err } diff --git a/cli/formatter/opts.go b/cli/formatter/opts.go index 1130686c4..cf31eb84d 100644 --- a/cli/formatter/opts.go +++ b/cli/formatter/opts.go @@ -2,7 +2,7 @@ package formatter // Opts contains formatting options. type Opts struct { - // Graphics sets on/off the output of pseudographic characters. + // Graphics sets on/off the output of pseudographics characters. Graphics bool // ColumnWidthMax sets is a maximum width of columns. ColumnWidthMax int diff --git a/cli/formatter/table.go b/cli/formatter/table.go index f735152c9..8a584d4ca 100644 --- a/cli/formatter/table.go +++ b/cli/formatter/table.go @@ -377,20 +377,20 @@ func renderBatch(batch []any, transpose bool, opts Opts) (string, error) { anyMaps = append(anyMaps, castedMap) } - mapsBatchs := make([][]unorderedMap[any], len(anyMaps)) + mapsBatches := make([][]unorderedMap[any], len(anyMaps)) batchPointer := 0 - mapsBatchs[batchPointer] = append(mapsBatchs[batchPointer], anyMaps[0]) + mapsBatches[batchPointer] = append(mapsBatches[batchPointer], anyMaps[0]) for i := 0; i < len(anyMaps)-1; i++ { if !isMapKeysEqual(anyMaps[i], anyMaps[i+1]) { batchPointer++ } - mapsBatchs[batchPointer] = append(mapsBatchs[batchPointer], anyMaps[i+1]) + mapsBatches[batchPointer] = append(mapsBatches[batchPointer], anyMaps[i+1]) } var res, batchRes string var err error - for _, batch := range mapsBatchs { + for _, batch := range mapsBatches { if len(batch) != 0 { batchRes, err = renderEqualMaps(batch, transpose, opts) if err != nil { @@ -439,7 +439,7 @@ type metadataRows struct { Rows [][]any `yaml:"rows"` } -// remapMetadataRows creates maps from rows with a metainformation. +// remapMetadataRows creates maps from rows with a meta information. func remapMetadataRows(meta metadataRows) []any { var nodes []any maxLen := 0 diff --git a/cli/install/install.go b/cli/install/install.go index d1de89f49..925c03fce 100644 --- a/cli/install/install.go +++ b/cli/install/install.go @@ -203,12 +203,12 @@ func detectOsName() (string, error) { // getVersionsFromRepo returns all available versions from github repository. func getVersionsFromRepo(local bool, distfiles, program string, - repolink string, + repoLink string, ) ([]version.Version, error) { if local { return search.GetVersionsFromGitLocal(filepath.Join(distfiles, program)) } - return search.GetVersionsFromGitRemote(repolink) + return search.GetVersionsFromGitRemote(repoLink) } // getCommit returns all available commits from repository. diff --git a/cli/pack/common.go b/cli/pack/common.go index 245c57e13..e639bfd00 100644 --- a/cli/pack/common.go +++ b/cli/pack/common.go @@ -39,6 +39,8 @@ const ( ignoreFile = ".packignore" ) +// spell-checker:ignore Rgxps + var versionRgxps = []*regexp.Regexp{ regexp.MustCompile(`^(?P\d+)$`), regexp.MustCompile(`^(?P\d+)\.(?P\d+)$`), @@ -164,7 +166,7 @@ func previousPackageFilters(packCtx *PackCtx) []skipFilter { // appSrcCopySkip returns a filter func to filter out artifacts paths. func appSrcCopySkip(packCtx *PackCtx, cliOpts *config.CliOpts, srcAppPath string, -) (func(srcinfo os.FileInfo, src, dest string) (bool, error), error) { +) (func(srcInfo os.FileInfo, src, dest string) (bool, error), error) { appCopyFilters := appArtifactsFilters(cliOpts, srcAppPath) appCopyFilters = append(appCopyFilters, ttEnvironmentFilters(packCtx, cliOpts)...) appCopyFilters = append(appCopyFilters, previousPackageFilters(packCtx)...) @@ -177,9 +179,9 @@ func appSrcCopySkip(packCtx *PackCtx, cliOpts *config.CliOpts, return nil, fmt.Errorf("failed to load %q: %w", ignoreFile, err) } - return func(srcinfo os.FileInfo, src, dest string) (bool, error) { + return func(srcInfo os.FileInfo, src, dest string) (bool, error) { for _, shouldSkip := range appCopyFilters { - if shouldSkip(srcinfo, src) { + if shouldSkip(srcInfo, src) { return true, nil } } diff --git a/cli/pack/cpio.go b/cli/pack/cpio.go index def085740..3a456c365 100644 --- a/cli/pack/cpio.go +++ b/cli/pack/cpio.go @@ -25,7 +25,7 @@ func packCpio(relPaths []string, resFileName, packageFilesDir string) error { filesBuffer := bytes.Buffer{} filesBuffer.WriteString(strings.Join(relPaths, "\n")) - cmd := exec.Command("cpio", "-o", "-H", "newc") + cmd := exec.Command("cpio", "-o", "-H", "newc") // spell-checker:disable-line cmd.Stdin = &filesBuffer cmd.Stdout = cpioFileWriter cmd.Stderr = &stderrBuf diff --git a/cli/pack/deb.go b/cli/pack/deb.go index b2c5dabe4..acc0b08c1 100644 --- a/cli/pack/deb.go +++ b/cli/pack/deb.go @@ -196,8 +196,8 @@ func createDebianBinary(packageDir string) error { return nil } -// getTntTTAsDeps returns tarantool and tt cli from bin_dir as dependencies. -func getTntTTAsDeps(cmdCtx *cmdcontext.CmdCtx) (PackDependencies, error) { +// getTntTtAsDeps returns tarantool and tt cli from bin_dir as dependencies. +func getTntTtAsDeps(cmdCtx *cmdcontext.CmdCtx) (PackDependencies, error) { tntVerParsed, err := cmdCtx.Cli.TarantoolCli.GetVersion() if err != nil { return nil, err diff --git a/cli/pack/deb_control_dir_test.go b/cli/pack/deb_control_dir_test.go index edc4b4314..2caf87d4e 100644 --- a/cli/pack/deb_control_dir_test.go +++ b/cli/pack/deb_control_dir_test.go @@ -86,7 +86,7 @@ func TestCreateControlDir(t *testing.T) { }, }, { - name: "Unexisting postinst script passed", + name: "Non-existing postinst script passed", packCtx: &PackCtx{ Name: "test", Version: "1.0.0", @@ -110,7 +110,7 @@ func TestCreateControlDir(t *testing.T) { }, }, { - name: "Unexisting preinst script passed", + name: "Non-existing preinst script passed", packCtx: &PackCtx{ Name: "test", Version: "1.0.0", @@ -167,7 +167,7 @@ func TestCreateControlFile(t *testing.T) { }, }, { - name: "Unexisting base directory", + name: "Non-existing base directory", basePath: "nothing", debControlCtx: &map[string]interface{}{ "Name": "test", diff --git a/cli/pack/deb_test.go b/cli/pack/deb_test.go index 6f5e1f746..f54341a79 100644 --- a/cli/pack/deb_test.go +++ b/cli/pack/deb_test.go @@ -21,7 +21,7 @@ func TestCreateDebianBinary(t *testing.T) { }, }, { - name: "Unexisting directory", + name: "Non-existing directory", packageDir: "nothing", correctErr: func(err error) bool { return strings.Contains(err.Error(), diff --git a/cli/pack/deps.go b/cli/pack/deps.go index d970b3798..075a9b162 100644 --- a/cli/pack/deps.go +++ b/cli/pack/deps.go @@ -36,7 +36,7 @@ func parseAllDependencies(cmdCtx *cmdcontext.CmdCtx, } if packCtx.RpmDeb.WithTarantoolDeps { - ttBinDeps, err := getTntTTAsDeps(cmdCtx) + ttBinDeps, err := getTntTtAsDeps(cmdCtx) if err != nil { return nil, err } diff --git a/cli/pack/ignore_test.go b/cli/pack/ignore_test.go index d82f17e36..821ddbd49 100644 --- a/cli/pack/ignore_test.go +++ b/cli/pack/ignore_test.go @@ -15,6 +15,8 @@ import ( "github.com/stretchr/testify/assert" ) +// spell-checker:ignore blabla fooo + // transformMapValues is a generic mapper function that returns map with the same keys // and values mapped from the originals with fn function. func transformMapValues[K comparable, V0, V any](src map[K]V0, fn func(V0) V) map[K]V { @@ -115,7 +117,7 @@ var ignoreTestData_namesOnly = map[string]ignoreTestData{ }, mismatches: []string{ "f+oo2", - "ffoo", + "ffoo", // spell-checker:disable-line ".f+oo", "blabla_f+oo2", "f+oo2_blabla", @@ -455,7 +457,7 @@ func ignoreFilterCreateMockFS(t *testing.T, tc ignoreFilterCase) fs.FS { } func checkIgnoreFilter(t *testing.T, testCases ignoreFilterCases) { - basedst := t.TempDir() + baseDst := t.TempDir() // Do test for name, tc := range testCases { @@ -466,14 +468,14 @@ func checkIgnoreFilter(t *testing.T, testCases ignoreFilterCases) { assert.Nil(t, err) assert.NotNil(t, filter) - dst := filepath.Join(basedst, name) + dst := filepath.Join(baseDst, name) err = os.MkdirAll(dst, 0o755) assert.Nil(t, err) err = copy.Copy(".", dst, copy.Options{ FS: fsys, - Skip: func(srcinfo os.FileInfo, src, dest string) (bool, error) { - return filter(srcinfo, src), nil + Skip: func(srcInfo os.FileInfo, src, dest string) (bool, error) { + return filter(srcInfo, src), nil }, PermissionControl: copy.AddPermission(0o755), }) diff --git a/cli/pack/rpm_const.go b/cli/pack/rpm_const.go index eb30f4580..4bdc08293 100644 --- a/cli/pack/rpm_const.go +++ b/cli/pack/rpm_const.go @@ -25,7 +25,7 @@ const ( rpmTypeString = 6 rpmTypeBin = 7 rpmTypeStringArray = 8 - rpmTypeI18nstring = 9 + rpmTypeI18nString = 9 signatureTagSize = 1000 signatureTagMD5 = 1004 @@ -47,24 +47,24 @@ const ( tagPayloadFormat = 1124 tagPayloadCompressor = 1125 tagPayloadFlags = 1126 - tagPrein = 1023 - tagPostin = 1024 - tagPreinProg = 1085 - tagPostinProg = 1086 + tagPreIn = 1023 + tagPostIn = 1024 + tagPreInProg = 1085 + tagPostInProg = 1086 tagDirNames = 1118 tagBaseNames = 1117 tagDirIndexes = 1116 - tagFileUsernames = 1039 - tagFileGroupnames = 1040 + tagFileUserNames = 1039 + tagFileGroupNames = 1040 tagFileSizes = 1028 tagFileModes = 1030 - tagFileInodes = 1096 + tagFileINodes = 1096 tagFileDevices = 1095 tagRpmVersion = 1064 - tagFileMtimes = 1034 + tagFileMTimes = 1034 tagFileFlags = 1037 tagFileLangs = 1097 - tagFileRdevs = 1033 + tagFileRDevs = 1033 tagFileDigests = 1035 tagFileLinkTos = 1036 tagRequireFlags = 1048 @@ -76,12 +76,12 @@ const ( rpmSenseLess = 0x02 rpmSenseGreater = 0x04 rpmSenseEqual = 0x08 - rpmSensePrereq = 0x40 + rpmSensePreReq = 0x40 rpmSenseInterp = 0x100 rpmSenseScriptPre = 0x200 rpmSenseScriptPost = 0x400 - rpmSenseScriptPreun = 0x800 - rpmSenseScriptPostun = 0x1000 + rpmSenseScriptPreUn = 0x800 + rpmSenseScriptPostUn = 0x1000 ) var ( diff --git a/cli/pack/rpm_header.go b/cli/pack/rpm_header.go index bd87491b4..9e4a43a07 100644 --- a/cli/pack/rpm_header.go +++ b/cli/pack/rpm_header.go @@ -26,11 +26,11 @@ type filesInfo struct { FileGroupNames []string FileSizes []int32 FileModes []int16 - FileInodes []int32 + FileINodes []int32 FileDevices []int32 - FileMtimes []int32 + FileMTimes []int32 FileLangs []string - FileRdevs []int16 + FileRDevs []int16 FileLinkTos []string FileFlags []int32 FileDigests []string @@ -122,21 +122,21 @@ func addPreAndPostInstallScriptsRPM(rpmHeader *rpmTagSetType, } rpmHeader.addTags([]rpmTagType{ - {ID: tagPrein, Type: rpmTypeString, Value: preInstScript}, - {ID: tagPostin, Type: rpmTypeString, Value: postInstScript}, + {ID: tagPreIn, Type: rpmTypeString, Value: preInstScript}, + {ID: tagPostIn, Type: rpmTypeString, Value: postInstScript}, }...) return nil } // genRpmHeader generates rpm headers. -func genRpmHeader(relPaths []string, cpioPath, compresedCpioPath, packageFilesDir string, +func genRpmHeader(relPaths []string, cpioPath, compressedCpioPath, packageFilesDir string, cmdCtx *cmdcontext.CmdCtx, packCtx *PackCtx, opts *config.CliOpts, ) (rpmTagSetType, error) { rpmHeader := rpmTagSetType{} // Compute payload digest. payloadDigestAlgo := hashAlgoSHA256 - payloadDigest, err := util.FileSHA256Hex(compresedCpioPath) + payloadDigest, err := util.FileSHA256Hex(compressedCpioPath) if err != nil { return nil, fmt.Errorf("failed to get payload digest: %s", err) } @@ -188,21 +188,21 @@ func genRpmHeader(relPaths []string, cpioPath, compresedCpioPath, packageFilesDi {ID: tagPayloadCompressor, Type: rpmTypeString, Value: "gzip"}, {ID: tagPayloadFlags, Type: rpmTypeString, Value: "5"}, - {ID: tagPreinProg, Type: rpmTypeString, Value: "/bin/sh"}, - {ID: tagPostinProg, Type: rpmTypeString, Value: "/bin/sh"}, + {ID: tagPreInProg, Type: rpmTypeString, Value: "/bin/sh"}, + {ID: tagPostInProg, Type: rpmTypeString, Value: "/bin/sh"}, {ID: tagDirNames, Type: rpmTypeStringArray, Value: filesInfo.DirNames}, {ID: tagBaseNames, Type: rpmTypeStringArray, Value: filesInfo.BaseNames}, {ID: tagDirIndexes, Type: rpmTypeInt32, Value: filesInfo.DirIndexes}, - {ID: tagFileUsernames, Type: rpmTypeStringArray, Value: filesInfo.FileUserNames}, - {ID: tagFileGroupnames, Type: rpmTypeStringArray, Value: filesInfo.FileGroupNames}, + {ID: tagFileUserNames, Type: rpmTypeStringArray, Value: filesInfo.FileUserNames}, + {ID: tagFileGroupNames, Type: rpmTypeStringArray, Value: filesInfo.FileGroupNames}, {ID: tagFileSizes, Type: rpmTypeInt32, Value: filesInfo.FileSizes}, {ID: tagFileModes, Type: rpmTypeInt16, Value: filesInfo.FileModes}, - {ID: tagFileInodes, Type: rpmTypeInt32, Value: filesInfo.FileInodes}, + {ID: tagFileINodes, Type: rpmTypeInt32, Value: filesInfo.FileINodes}, {ID: tagFileDevices, Type: rpmTypeInt32, Value: filesInfo.FileDevices}, - {ID: tagFileRdevs, Type: rpmTypeInt16, Value: filesInfo.FileRdevs}, - {ID: tagFileMtimes, Type: rpmTypeInt32, Value: filesInfo.FileMtimes}, + {ID: tagFileRDevs, Type: rpmTypeInt16, Value: filesInfo.FileRDevs}, + {ID: tagFileMTimes, Type: rpmTypeInt32, Value: filesInfo.FileMTimes}, {ID: tagFileFlags, Type: rpmTypeInt32, Value: filesInfo.FileFlags}, {ID: tagFileLangs, Type: rpmTypeStringArray, Value: filesInfo.FileLangs}, {ID: tagFileDigests, Type: rpmTypeStringArray, Value: filesInfo.FileDigests}, @@ -259,7 +259,7 @@ func getFilesInfo(relPaths []string, dirPath string, info.DirIndexes = append(info.DirIndexes, int32(dirIndex)) info.BaseNames = append(info.BaseNames, filepath.Base(relPath)) - info.FileMtimes = append(info.FileMtimes, int32(fileInfo.ModTime().Unix())) + info.FileMTimes = append(info.FileMTimes, int32(fileInfo.ModTime().Unix())) if packFileInfo, found := pkgFiles[relPath]; found { info.FileUserNames = append(info.FileUserNames, packFileInfo.owner) @@ -294,9 +294,9 @@ func getFilesInfo(relPaths []string, dirPath string, } info.FileSizes = append(info.FileSizes, int32(sysFileInfo.Size)) info.FileModes = append(info.FileModes, int16(sysFileInfo.Mode)) - info.FileInodes = append(info.FileInodes, int32(sysFileInfo.Ino)) + info.FileINodes = append(info.FileINodes, int32(sysFileInfo.Ino)) info.FileDevices = append(info.FileDevices, int32(sysFileInfo.Dev)) - info.FileRdevs = append(info.FileRdevs, int16(sysFileInfo.Rdev)) + info.FileRDevs = append(info.FileRDevs, int16(sysFileInfo.Rdev)) } return info, nil diff --git a/cli/pack/rpm_lead.go b/cli/pack/rpm_lead.go index 54efe4a2d..3dc404266 100644 --- a/cli/pack/rpm_lead.go +++ b/cli/pack/rpm_lead.go @@ -9,13 +9,13 @@ func genRpmLead(name string) *bytes.Buffer { // The Lead is a legacy structure that used to describe RPM files // before header sections were introduced. // - // struct rpmlead { + // struct rpm_lead { // unsigned char magic[4]; // unsigned char major, minor; // short type; - // short archnum; + // short arch_num; // char name[66]; - // short osnum; + // short os_num; // short signature_type; // char reserved[16]; // } ; @@ -30,9 +30,9 @@ func genRpmLead(name string) *bytes.Buffer { uint8(3), // major uint8(0), // minor int16(0), // type - int16(1), // archnum + int16(1), // arch_num rpmLeadName, // name - int16(1), // osnum + int16(1), // os_num int16(5), // signature_type [16]int8{}, // reserved ) diff --git a/cli/pack/rpm_pack.go b/cli/pack/rpm_pack.go index 8316485bf..4e27ded3d 100644 --- a/cli/pack/rpm_pack.go +++ b/cli/pack/rpm_pack.go @@ -15,6 +15,7 @@ import ( "github.com/tarantool/tt/cli/util" ) +// spell-checker:ignore knazarov mkrepo //nolint - some links from description are too long /** * @@ -80,14 +81,14 @@ func packRpm(cmdCtx *cmdcontext.CmdCtx, packCtx *PackCtx, opts *config.CliOpts, return fmt.Errorf("failed to pack CPIO: %s", err) } - compresedCpioPath := filepath.Join(packageDir, "cpio.gz") - if err := CompressGzip(cpioPath, compresedCpioPath); err != nil { + compressedCpioPath := filepath.Join(packageDir, "cpio.gz") + if err := CompressGzip(cpioPath, compressedCpioPath); err != nil { return fmt.Errorf("failed to compress CPIO: %s", err) } log.Info("Generating header section") - rpmHeader, err := genRpmHeader(relPaths, cpioPath, compresedCpioPath, packageDir, + rpmHeader, err := genRpmHeader(relPaths, cpioPath, compressedCpioPath, packageDir, cmdCtx, packCtx, opts) if err != nil { return fmt.Errorf("failed to gen RPM header: %s", err) @@ -112,7 +113,7 @@ func packRpm(cmdCtx *cmdcontext.CmdCtx, packCtx *PackCtx, opts *config.CliOpts, // Create body file = header + compressedCpio. rpmBodyFilePath := filepath.Join(packageDir, "body") - if err := util.MergeFiles(rpmBodyFilePath, rpmHeaderFilePath, compresedCpioPath); err != nil { + if err := util.MergeFiles(rpmBodyFilePath, rpmHeaderFilePath, compressedCpioPath); err != nil { return fmt.Errorf("failed to concat RPM header with compressed payload: %s", err) } diff --git a/cli/pack/rpm_tagset.go b/cli/pack/rpm_tagset.go index 604608a66..785fc84b7 100644 --- a/cli/pack/rpm_tagset.go +++ b/cli/pack/rpm_tagset.go @@ -27,6 +27,8 @@ func (tagSet *rpmTagSetType) addTags(tags ...rpmTagType) { *tagSet = append(*tagSet, tags...) } +// spell-checker:ignore knazarov eade + /** * * Bless @knazarov for writing this code once, diff --git a/cli/pack/rpm_tagset_test.go b/cli/pack/rpm_tagset_test.go index 441ccfe12..c56d9f5b7 100644 --- a/cli/pack/rpm_tagset_test.go +++ b/cli/pack/rpm_tagset_test.go @@ -26,12 +26,12 @@ func TestPackTag(t *testing.T) { var packed *packedTagType // NULL - nulltag := rpmTagType{ + nullTag := rpmTagType{ Type: rpmTypeNull, Value: nil, } - packed, err = packTag(nulltag) + packed, err = packTag(nullTag) assert.Nil(err) assert.Equal(1, packed.Count) assert.Equal("", hex(packed.Data)) diff --git a/cli/replicaset/bootstrap.go b/cli/replicaset/bootstrap.go index 374b387ff..7d13017ef 100644 --- a/cli/replicaset/bootstrap.go +++ b/cli/replicaset/bootstrap.go @@ -25,14 +25,14 @@ type Bootstrapper interface { // newErrBootstrapByInstanceNotSupported creates a new error that bootstrap is not // supported by the orchestrator for a single instance. -func newErrBootstrapByInstanceNotSupported(orhestrator Orchestrator) error { +func newErrBootstrapByInstanceNotSupported(orchestrator Orchestrator) error { return fmt.Errorf("bootstrap is not supported for a single instance by %q orchestrator", - orhestrator) + orchestrator) } // newErrBootstrapByAppNotSupported creates a new error that bootstrap is not // supported by the orchestrator for an application. -func newErrBootstrapByAppNotSupported(orhestrator Orchestrator) error { +func newErrBootstrapByAppNotSupported(orchestrator Orchestrator) error { return fmt.Errorf("bootstrap is not supported for an application by %q orchestrator", - orhestrator) + orchestrator) } diff --git a/cli/replicaset/cartridge.go b/cli/replicaset/cartridge.go index 2189f2d72..2350991eb 100644 --- a/cli/replicaset/cartridge.go +++ b/cli/replicaset/cartridge.go @@ -201,7 +201,7 @@ func (c *CartridgeInstance) Bootstrap(ctx BootstrapCtx) error { func (c *CartridgeInstance) BootstrapVShard(ctx VShardBootstrapCtx) error { err := cartridgeBootstrapVShard(c.evaler, ctx.Timeout) if err != nil { - return wrapCartridgeVShardBoostrapError(err) + return wrapCartridgeVShardBootstrapError(err) } return nil } @@ -412,6 +412,7 @@ func (c *CartridgeApplication) Bootstrap(ctx BootstrapCtx) error { instancesCfg, ctx.Timeout) } } else { + // spell-checker:ignore replicasetsc // Bootstrap a replicasets from the config. replicasetCfg, replicasetscCfgPath, err := getCartridgeReplicasetsConfig(appDir, ctx.ReplicasetsFile) @@ -668,7 +669,7 @@ func (c *CartridgeApplication) BootstrapVShard(ctx VShardBootstrapCtx) error { return lastErr == nil, nil } err = EvalForeachAliveDiscovered(c.runningCtx.Instances, replicasets, InstanceEvalFunc(evaler)) - for _, e := range []error{err, wrapCartridgeVShardBoostrapError(lastErr)} { + for _, e := range []error{err, wrapCartridgeVShardBootstrapError(lastErr)} { if e != nil { return fmt.Errorf("failed to bootstrap vshard: %w", e) } @@ -741,7 +742,7 @@ func (c *CartridgeApplication) RolesChange(ctx RolesChangeCtx, } // getRolesChangedOpts adds/removes role for replicaset roles list and returns -// options for updating a replciaset. +// options for updating a replicaset. func getRolesChangedOpts(targetReplicaset Replicaset, action RolesChangerAction, roleName, groupName string, ) (cartridgeEditReplicasetsOpts, error) { @@ -995,7 +996,7 @@ func cartridgePromote(evaler connector.Evaler, opts := cartridgeFailoverPromoteOpts{ Leaders: leaders, ForceInconsistency: force, - // Anyway print an error if vclockkeeper was changed in + // Anyway print an error if vclock keeper was changed in // etcd during inconsistency forcing. // https://github.com/tarantool/cartridge/blob/1c07213c058cfb500a8046175407ed46acf6cb44/cartridge/failover.lua#L1112-L1114 SkipErrorOnChange: false, @@ -1016,10 +1017,10 @@ func cartridgeBootstrapVShard(evaler connector.Evaler, timeout int) error { return err } -// wrapCartridgeVShardBoostrapError wraps a cartridge vshard bootstrap error +// wrapCartridgeVShardBootstrapError wraps a cartridge vshard bootstrap error // with an additional information. // https://github.com/tarantool/cartridge/issues/1148 -func wrapCartridgeVShardBoostrapError(err error) error { +func wrapCartridgeVShardBootstrapError(err error) error { if err != nil && strings.Contains(err.Error(), "Sharding config is empty") { return fmt.Errorf( "it's possible that there are no running instances of some configured vshard groups. "+ diff --git a/cli/replicaset/cartridge_test.go b/cli/replicaset/cartridge_test.go index 38b0602f3..dc512ee0f 100644 --- a/cli/replicaset/cartridge_test.go +++ b/cli/replicaset/cartridge_test.go @@ -13,6 +13,8 @@ import ( "github.com/tarantool/tt/cli/running" ) +// spell-checker:ignore someinstanceuuid someleaderuuid somereplicasetuuid otherinstanceuuid + var ( _ replicaset.Discoverer = &replicaset.CartridgeInstance{} _ replicaset.Promoter = &replicaset.CartridgeInstance{} diff --git a/cli/replicaset/cconfig.go b/cli/replicaset/cconfig.go index b165e2f83..02681e82e 100644 --- a/cli/replicaset/cconfig.go +++ b/cli/replicaset/cconfig.go @@ -199,7 +199,7 @@ func (c *CConfigApplication) discovery() (Replicasets, error) { return mergeCConfigTopologies(topologies) } -// Expel expels an instance from the cetralized config's replicasets. +// Expel expels an instance from the centralized config's replicasets. func (c *CConfigApplication) Expel(ctx ExpelCtx) error { replicasets, err := c.Discovery(UseCache) if err != nil { @@ -233,7 +233,7 @@ func (c *CConfigApplication) Expel(ctx ExpelCtx) error { msg := fmt.Sprintf("could not connect to: %s", strings.Join(unfound, ",")) if !ctx.Force { return fmt.Errorf( - "all other instances in the target replicast should be online, %s", msg) + "all other instances in the target replicaset should be online, %s", msg) } log.Warn(msg) } @@ -311,6 +311,7 @@ func mergeCConfigTopologies(topologies []cconfigTopology) (Replicasets, error) { // Clear expelled instances. for i := range replicasets.Replicasets { + // spell-checker:ignore unexpelled unexpelled := []Instance{} for _, instance := range replicasets.Replicasets[i].Instances { if instance.URI != "" { @@ -606,9 +607,9 @@ func reloadCConfig(instances []running.InstanceCtx) error { func (c *CConfigApplication) promote(instance Instance, ctx PromoteCtx, ) (wasConfigPublished bool, err error) { - cluterCfgPath := instance.InstanceCtx.ClusterConfigPath + clusterCfgPath := instance.InstanceCtx.ClusterConfigPath clusterCfg, err := cluster.GetClusterConfig( - libcluster.NewCollectorFactory(c.collectors), cluterCfgPath) + libcluster.NewCollectorFactory(c.collectors), clusterCfgPath) if err != nil { return false, fmt.Errorf("failed to get cluster config: %w", err) } @@ -627,7 +628,7 @@ func (c *CConfigApplication) promote(instance Instance, } err = patchLocalCConfig( - cluterCfgPath, + clusterCfgPath, c.collectors, c.publishers, func(config *libcluster.Config) (*libcluster.Config, error) { @@ -645,9 +646,9 @@ func (c *CConfigApplication) promote(instance Instance, func (c *CConfigApplication) demote(instance Instance, replicaset Replicaset, ctx DemoteCtx, ) (wasConfigPublished bool, err error) { - cluterCfgPath := instance.InstanceCtx.ClusterConfigPath + clusterCfgPath := instance.InstanceCtx.ClusterConfigPath clusterCfg, err := cluster.GetClusterConfig(libcluster.NewCollectorFactory(c.collectors), - cluterCfgPath) + clusterCfgPath) if err != nil { return false, fmt.Errorf("failed to get cluster config: %w", err) } @@ -674,7 +675,7 @@ func (c *CConfigApplication) demote(instance Instance, } err = patchLocalCConfig( - cluterCfgPath, + clusterCfgPath, c.collectors, c.publishers, func(config *libcluster.Config) (*libcluster.Config, error) { diff --git a/cli/replicaset/cconfig_test.go b/cli/replicaset/cconfig_test.go index 725602038..71e9d4a79 100644 --- a/cli/replicaset/cconfig_test.go +++ b/cli/replicaset/cconfig_test.go @@ -12,6 +12,9 @@ import ( "github.com/tarantool/tt/cli/running" ) +// spell-checker:ignore somealias someinstanceuuid someleaderuuid somereplicasetuuid anyuri +// spell-checker:ignore otherinstanceuuid instanceuuid instancerw + var ( _ replicaset.Discoverer = &replicaset.CConfigInstance{} _ replicaset.Promoter = &replicaset.CConfigInstance{} diff --git a/cli/replicaset/cmd/bootstrap.go b/cli/replicaset/cmd/bootstrap.go index 045ab59f1..708c4275a 100644 --- a/cli/replicaset/cmd/bootstrap.go +++ b/cli/replicaset/cmd/bootstrap.go @@ -9,10 +9,10 @@ import ( ) // BootstrapCtx describes context to bootstrap an instance or application. -type BootstapCtx struct { +type BootstrapCtx struct { // ReplicasetsFile is a Cartridge replicasets file. ReplicasetsFile string - // Orchestrator is a forced orchestator choice. + // Orchestrator is a forced orchestrator choice. Orchestrator replicaset.Orchestrator // RunningCtx is an application running context. RunningCtx running.RunningCtx @@ -28,7 +28,7 @@ type BootstapCtx struct { } // Bootstrap bootstraps an instance or application. -func Bootstrap(ctx BootstapCtx) error { +func Bootstrap(ctx BootstrapCtx) error { if ctx.Instance != "" { if ctx.Replicaset == "" { return fmt.Errorf("the replicaset must be specified to bootstrap an instance") diff --git a/cli/replicaset/cmd/demote.go b/cli/replicaset/cmd/demote.go index a7f34b8e0..9c5b43672 100644 --- a/cli/replicaset/cmd/demote.go +++ b/cli/replicaset/cmd/demote.go @@ -18,7 +18,7 @@ type DemoteCtx struct { Publishers libcluster.DataPublisherFactory // Collectors is data collector factory. Collectors libcluster.DataCollectorFactory - // Orchestrator is a forced orchestator choice. + // Orchestrator is a forced orchestrator choice. Orchestrator replicaset.Orchestrator // Conn is an active connection to a passed instance. Conn connector.Connector diff --git a/cli/replicaset/cmd/downgrade.go b/cli/replicaset/cmd/downgrade.go index 403e96905..902c76748 100644 --- a/cli/replicaset/cmd/downgrade.go +++ b/cli/replicaset/cmd/downgrade.go @@ -99,7 +99,7 @@ func downgradeMaster(master *instanceMeta, version string) (syncInfo, error) { func downgradeReplicaset(replicaset replicaset.Replicaset, lsnTimeout int, version string, connOpts connector.ConnectOpts, ) error { - master, replicas, err := collectRWROInfo(replicaset, connOpts) + master, replicas, err := collectRwRoInfo(replicaset, connOpts) if err != nil { return err } diff --git a/cli/replicaset/cmd/expel.go b/cli/replicaset/cmd/expel.go index 8ce8bb5e8..f0da30948 100644 --- a/cli/replicaset/cmd/expel.go +++ b/cli/replicaset/cmd/expel.go @@ -19,7 +19,7 @@ type ExpelCtx struct { Publishers libcluster.DataPublisherFactory // Collectors is data collector factory. Collectors libcluster.DataCollectorFactory - // Orchestrator is a forced orchestator choice. + // Orchestrator is a forced orchestrator choice. Orchestrator replicaset.Orchestrator // RunningCtx is an application running context. RunningCtx running.RunningCtx diff --git a/cli/replicaset/cmd/promote.go b/cli/replicaset/cmd/promote.go index 7c1dc89ee..f2a2b714d 100644 --- a/cli/replicaset/cmd/promote.go +++ b/cli/replicaset/cmd/promote.go @@ -21,7 +21,7 @@ type PromoteCtx struct { Collectors libcluster.DataCollectorFactory // IsApplication true if an application passed. IsApplication bool - // Orchestrator is a forced orchestator choice. + // Orchestrator is a forced orchestrator choice. Orchestrator replicaset.Orchestrator // Conn is an active connection to a passed instance. Conn connector.Connector diff --git a/cli/replicaset/cmd/roles.go b/cli/replicaset/cmd/roles.go index e9acd514d..79858710a 100644 --- a/cli/replicaset/cmd/roles.go +++ b/cli/replicaset/cmd/roles.go @@ -29,7 +29,7 @@ type RolesChangeCtx struct { Collectors libcluster.DataCollectorFactory // IsApplication is true if an application passed. IsApplication bool - // Orchestrator is a forced orchestator choice. + // Orchestrator is a forced orchestrator choice. Orchestrator replicaset.Orchestrator // Conn is an active connection to a passed instance. Conn connector.Connector diff --git a/cli/replicaset/cmd/upgrade.go b/cli/replicaset/cmd/upgrade.go index 0a56ab76a..e8f69fd02 100644 --- a/cli/replicaset/cmd/upgrade.go +++ b/cli/replicaset/cmd/upgrade.go @@ -136,13 +136,13 @@ func getInstanceConnector(instance replicaset.Instance, return conn, nil } -func collectRWROInfo(replset replicaset.Replicaset, +func collectRwRoInfo(rs replicaset.Replicaset, connOpts connector.ConnectOpts) (*instanceMeta, []instanceMeta, error, ) { var master *instanceMeta = nil var replicas []instanceMeta - for _, instance := range replset.Instances { + for _, instance := range rs.Instances { run := instance.InstanceCtx fullInstanceName := running.GetAppInstanceName(run) conn, err := getInstanceConnector(instance, connOpts) @@ -260,7 +260,7 @@ func snapshot(instance *instanceMeta) error { func upgradeReplicaset(replicaset replicaset.Replicaset, lsnTimeout int, connOpts connector.ConnectOpts, ) error { - master, replicas, err := collectRWROInfo(replicaset, connOpts) + master, replicas, err := collectRwRoInfo(replicaset, connOpts) if err != nil { return err } diff --git a/cli/replicaset/cmd/vshard.go b/cli/replicaset/cmd/vshard.go index f67a8b45e..d3023d0dc 100644 --- a/cli/replicaset/cmd/vshard.go +++ b/cli/replicaset/cmd/vshard.go @@ -25,7 +25,7 @@ type VShardCmdCtx struct { RunningCtx running.RunningCtx // Conn is an active connection to a passed instance. Conn connector.Connector - // Orchestrator is a forced orchestator choice. + // Orchestrator is a forced orchestrator choice. Orchestrator replicaset.Orchestrator // Publishers is data publisher factory. Publishers libcluster.DataPublisherFactory diff --git a/cli/replicaset/configsource_test.go b/cli/replicaset/configsource_test.go index 2a73b0679..55bae99f4 100644 --- a/cli/replicaset/configsource_test.go +++ b/cli/replicaset/configsource_test.go @@ -12,6 +12,8 @@ import ( libcluster "github.com/tarantool/tt/lib/cluster" ) +// spell-checker:ignore lexi + //go:embed testdata/cconfig_source/* var cconfigSourceTestDataFS embed.FS diff --git a/cli/replicaset/custom_test.go b/cli/replicaset/custom_test.go index 7c5a9529e..69bbf2ee3 100644 --- a/cli/replicaset/custom_test.go +++ b/cli/replicaset/custom_test.go @@ -11,6 +11,9 @@ import ( "github.com/tarantool/tt/cli/running" ) +// spell-checker:ignore somealias someinstanceuuid someleaderuuid somereplicasetuuid anyuri +// spell-checker:ignore otherinstanceuuid instanceuuid instancerw + var ( _ replicaset.Discoverer = &replicaset.CustomInstance{} _ replicaset.Promoter = &replicaset.CustomInstance{} @@ -507,3 +510,5 @@ func TestCustomInstance_RolesChange(t *testing.T) { }) } } + +// unmigrationgoog diff --git a/cli/replicaset/electionmode.go b/cli/replicaset/electionmode.go index 2b674ab3a..c2b4f75f2 100644 --- a/cli/replicaset/electionmode.go +++ b/cli/replicaset/electionmode.go @@ -13,7 +13,7 @@ const ( ElectionModeOff // off // ElectionModeVoter is a "voter" election_mode for centralized config. ElectionModeVoter // voter - // ElectionModeCandidate is a "candidate" election_mode for centrlalized config. + // ElectionModeCandidate is a "candidate" election_mode for centralized config. ElectionModeCandidate // candidate // ElectionModeManual is a "manual" election_mode for centralized config. ElectionModeManual // manual diff --git a/cli/replicaset/electionmode_string.go b/cli/replicaset/electionmode_string.go index 5eb49441d..cdc7304a0 100644 --- a/cli/replicaset/electionmode_string.go +++ b/cli/replicaset/electionmode_string.go @@ -15,7 +15,7 @@ func _() { _ = x[ElectionModeManual-4] } -const _ElectionMode_name = "unknownoffvotercandidatemanual" +const _ElectionMode_name = "unknownoffvotercandidatemanual" // spell-checker:disable-line var _ElectionMode_index = [...]uint8{0, 7, 10, 15, 24, 30} diff --git a/cli/replicaset/electionmode_test.go b/cli/replicaset/electionmode_test.go index c7b80208a..5e990a24e 100644 --- a/cli/replicaset/electionmode_test.go +++ b/cli/replicaset/electionmode_test.go @@ -42,7 +42,7 @@ func TestParseElectionMode(t *testing.T) { {"maNUAL", replicaset.ElectionModeManual}, {"unknown", replicaset.ElectionModeUnknown}, {"curiosity", replicaset.ElectionModeUnknown}, - {"offfoo", replicaset.ElectionModeUnknown}, + {"offfoo", replicaset.ElectionModeUnknown}, // spell-checker:disable-line } for _, tc := range cases { diff --git a/cli/replicaset/eval.go b/cli/replicaset/eval.go index f642a58ab..a5f03b055 100644 --- a/cli/replicaset/eval.go +++ b/cli/replicaset/eval.go @@ -45,7 +45,7 @@ type InstanceEvaler interface { type InstanceEvalFunc func(instance running.InstanceCtx, evaler connector.Evaler) (bool, error) -// Eval helps to satisfy the InstanceEvaler insterface. +// Eval helps to satisfy the InstanceEvaler interface. func (fun InstanceEvalFunc) Eval(instance running.InstanceCtx, evaler connector.Evaler, ) (bool, error) { @@ -53,20 +53,20 @@ func (fun InstanceEvalFunc) Eval(instance running.InstanceCtx, } // EvalForeach calls evaler for each instance. -func EvalForeach(instances []running.InstanceCtx, ievaler InstanceEvaler) error { - return evalForeach(instances, ievaler, false) +func EvalForeach(instances []running.InstanceCtx, iEvaler InstanceEvaler) error { + return evalForeach(instances, iEvaler, false) } // EvalForeachAlive calls evaler for each connectable instance. -func EvalForeachAlive(instances []running.InstanceCtx, ievaler InstanceEvaler) error { - return evalForeach(instances, ievaler, true) +func EvalForeachAlive(instances []running.InstanceCtx, iEvaler InstanceEvaler) error { + return evalForeach(instances, iEvaler, true) } // EvalAny calls evaler once for one connectable instance. -func EvalAny(instances []running.InstanceCtx, ievaler InstanceEvaler) error { +func EvalAny(instances []running.InstanceCtx, iEvaler InstanceEvaler) error { return EvalForeachAlive(instances, InstanceEvalFunc( func(instance running.InstanceCtx, evaler connector.Evaler) (bool, error) { - _, err := ievaler.Eval(instance, evaler) + _, err := iEvaler.Eval(instance, evaler) // Always return true to stop execution on the first instance. return true, err })) @@ -74,15 +74,15 @@ func EvalAny(instances []running.InstanceCtx, ievaler InstanceEvaler) error { // EvalForeachAliveDiscovered calls evaler for only connectable instances among discovered. func EvalForeachAliveDiscovered(instances []running.InstanceCtx, - discovered Replicasets, ievaler InstanceEvaler, + discovered Replicasets, iEvaler InstanceEvaler, ) error { - return EvalForeachAlive(filterDiscovered(instances, discovered), ievaler) + return EvalForeachAlive(filterDiscovered(instances, discovered), iEvaler) } // evalForeach is an internal implementation of iteration over instances with // an evaler object. func evalForeach(instances []running.InstanceCtx, - ievaler InstanceEvaler, skipConnectError bool, + iEvaler InstanceEvaler, skipConnectError bool, ) error { if len(instances) == 0 { return fmt.Errorf("no instances to connect") @@ -106,7 +106,7 @@ func evalForeach(instances []running.InstanceCtx, } connected++ - done, err := ievaler.Eval(instance, conn) + done, err := iEvaler.Eval(instance, conn) conn.Close() if err != nil { diff --git a/cli/replicaset/failover_string.go b/cli/replicaset/failover_string.go index d32787446..2e441ada6 100644 --- a/cli/replicaset/failover_string.go +++ b/cli/replicaset/failover_string.go @@ -17,7 +17,7 @@ func _() { _ = x[FailoverSupervised-6] } -const _Failover_name = "unknownoffmanualeventualelectionstatefulsupervised" +const _Failover_name = "unknownoffmanualeventualelectionstatefulsupervised" // spell-checker:disable-line var _Failover_index = [...]uint8{0, 7, 10, 16, 24, 32, 40, 50} diff --git a/cli/replicaset/failover_test.go b/cli/replicaset/failover_test.go index 5f5d1a36d..20454ff32 100644 --- a/cli/replicaset/failover_test.go +++ b/cli/replicaset/failover_test.go @@ -53,7 +53,7 @@ func TestParseFailover(t *testing.T) { {"SUPERvised", replicaset.FailoverSupervised}, {"unknown", replicaset.FailoverUnknown}, {"foo", replicaset.FailoverUnknown}, - {"offfoo", replicaset.FailoverUnknown}, + {"offfoo", replicaset.FailoverUnknown}, // spell-checker:disable-line } for _, tc := range cases { diff --git a/cli/replicaset/integration_test.go b/cli/replicaset/integration_test.go index ea6b709cd..503dbe39a 100644 --- a/cli/replicaset/integration_test.go +++ b/cli/replicaset/integration_test.go @@ -18,6 +18,8 @@ import ( "github.com/tarantool/tt/cli/running" ) +// spell-checker:ignore evaled + const ( workDir = "work_dir" server = "127.0.0.1:3015" @@ -227,7 +229,7 @@ func TestEvalForeachAlive_stops_after_failed_to_connect(t *testing.T) { { AppName: "app", InstName: "instance", - ConsoleSocket: "unreachetable", + ConsoleSocket: "unreachable", }, validInstance, } @@ -287,7 +289,7 @@ func TestEvalForeach_error(t *testing.T) { { AppName: "app", InstName: "inst", - ConsoleSocket: "unreachetable", + ConsoleSocket: "unreachable", }, }, "failed to connect to 'app:inst'", @@ -414,15 +416,15 @@ func TestEvalForeachAlive_error(t *testing.T) { { "no_connection", []running.InstanceCtx{ - {ConsoleSocket: "unreachetable"}, + {ConsoleSocket: "unreachable"}, }, "failed to connect to any instance", }, { "no_connections", []running.InstanceCtx{ - {ConsoleSocket: "unreachetable1"}, - {ConsoleSocket: "unreachetable2"}, + {ConsoleSocket: "unreachable1"}, + {ConsoleSocket: "unreachable2"}, }, "failed to connect to any instance", }, @@ -525,15 +527,15 @@ func TestEvalAny_error(t *testing.T) { { "no_connection", []running.InstanceCtx{ - {ConsoleSocket: "unreachetable"}, + {ConsoleSocket: "unreachable"}, }, "failed to connect to any instance", }, { "no_connections", []running.InstanceCtx{ - {ConsoleSocket: "unreachetable1"}, - {ConsoleSocket: "unreachetable2"}, + {ConsoleSocket: "unreachable1"}, + {ConsoleSocket: "unreachable2"}, }, "failed to connect to any instance", }, diff --git a/cli/replicaset/master_string.go b/cli/replicaset/master_string.go index 0112a6344..3f94fb80a 100644 --- a/cli/replicaset/master_string.go +++ b/cli/replicaset/master_string.go @@ -14,7 +14,7 @@ func _() { _ = x[MasterMulti-3] } -const _Master_name = "unknownnosinglemulti" +const _Master_name = "unknownnosinglemulti" // spell-checker:disable-line var _Master_index = [...]uint8{0, 7, 9, 15, 20} diff --git a/cli/replicaset/mode_string.go b/cli/replicaset/mode_string.go index 180280563..dc6f23e76 100644 --- a/cli/replicaset/mode_string.go +++ b/cli/replicaset/mode_string.go @@ -13,7 +13,7 @@ func _() { _ = x[ModeRW-2] } -const _Mode_name = "unknownreadrw" +const _Mode_name = "unknownreadrw" // spell-checker:disable-line var _Mode_index = [...]uint8{0, 7, 11, 13} diff --git a/cli/replicaset/orchestrator_string.go b/cli/replicaset/orchestrator_string.go index 848c42ed5..ac02dfb85 100644 --- a/cli/replicaset/orchestrator_string.go +++ b/cli/replicaset/orchestrator_string.go @@ -14,7 +14,7 @@ func _() { _ = x[OrchestratorCustom-3] } -const _Orchestrator_name = "unknowncentralized configcartridgecustom" +const _Orchestrator_name = "unknowncentralized configcartridgecustom" // spell-checker:disable-line var _Orchestrator_index = [...]uint8{0, 7, 25, 34, 40} diff --git a/cli/replicaset/state_string.go b/cli/replicaset/state_string.go index f4ed5fa46..c31844cb4 100644 --- a/cli/replicaset/state_string.go +++ b/cli/replicaset/state_string.go @@ -13,7 +13,7 @@ func _() { _ = x[StateBootstrapped-2] } -const _State_name = "unknownuninitializedbootstrapped" +const _State_name = "unknownuninitializedbootstrapped" // spell-checker:disable-line var _State_index = [...]uint8{0, 7, 20, 32} diff --git a/cli/replicaset/stateprovider.go b/cli/replicaset/stateprovider.go index 9c2d39389..e5806d7f8 100644 --- a/cli/replicaset/stateprovider.go +++ b/cli/replicaset/stateprovider.go @@ -9,6 +9,8 @@ type StateProvider int //go:generate stringer -type=StateProvider -trimprefix StateProvider -linecomment +// spell-checker:ignore etcdv + const ( // StateProviderUnknown is unknown type of a state provider. StateProviderUnknown StateProvider = iota // unknown diff --git a/cli/replicaset/stateprovider_string.go b/cli/replicaset/stateprovider_string.go index 6f36d94b0..0c77b19b3 100644 --- a/cli/replicaset/stateprovider_string.go +++ b/cli/replicaset/stateprovider_string.go @@ -14,7 +14,7 @@ func _() { _ = x[StateProviderEtcd2-3] } -const _StateProvider_name = "unknownnonetarantooletcd2" +const _StateProvider_name = "unknownnonetarantooletcd2" // spell-checker:disable-line var _StateProvider_index = [...]uint8{0, 7, 11, 20, 25} diff --git a/cli/replicaset/vshard.go b/cli/replicaset/vshard.go index f5101f2ab..4bb8ce7b6 100644 --- a/cli/replicaset/vshard.go +++ b/cli/replicaset/vshard.go @@ -23,7 +23,7 @@ func newErrBootstrapVShardByInstanceNotSupported(orchestrator Orchestrator) erro } // newErrBootstrapVShardByAppNotSupported creates a new error that vshard bootstrap is not -// supported by the orhestrator for an application. +// supported by the orchestrator for an application. func newErrBootstrapVShardByAppNotSupported(orchestrator Orchestrator) error { return fmt.Errorf("bootstrap vshard is not supported for an application by %q orchestrator", orchestrator) diff --git a/cli/rocks/rocks.go b/cli/rocks/rocks.go index 28d3ddefe..b0472a094 100644 --- a/cli/rocks/rocks.go +++ b/cli/rocks/rocks.go @@ -175,6 +175,7 @@ func Exec(cmdCtx *cmdcontext.CmdCtx, cliOpts *config.CliOpts, args []string) err extra_path := "extra/" rocks_path := "third_party/luarocks/src/" + // spell-checker:ignore manif deplocks sscm rocks_preload := map[string]string{ "extra.wrapper": extra_path + "wrapper.lua", "luarocks.core.hardcoded": extra_path + "hardcoded.lua", @@ -277,7 +278,7 @@ func Exec(cmdCtx *cmdcontext.CmdCtx, cliOpts *config.CliOpts, args []string) err L.SetGlobal("tt_getwd", L.NewFunction(getwdWrapperForLua)) preload := L.GetField(L.GetField(L.Get(lua.EnvironIndex), "package"), "preload") - for modname, path := range rocks_preload { + for modName, path := range rocks_preload { ctx, err := fs.ReadFile(luarocks, path) if err != nil { return err @@ -286,7 +287,7 @@ func Exec(cmdCtx *cmdcontext.CmdCtx, cliOpts *config.CliOpts, args []string) err if err != nil { return err } - L.SetField(preload, modname, mod) + L.SetField(preload, modName, mod) } if err := L.DoString(rocks_cmd); err != nil { diff --git a/cli/rocks/rocks_test.go b/cli/rocks/rocks_test.go index 9814e7609..2d647453c 100644 --- a/cli/rocks/rocks_test.go +++ b/cli/rocks/rocks_test.go @@ -11,6 +11,8 @@ import ( "github.com/tarantool/tt/cli/config" ) +// spell-checker:ignore emptyrepo + func TestAddLuarocksRepoOpts(t *testing.T) { type args struct { cliOpts *config.CliOpts @@ -119,7 +121,7 @@ func TestGetRocksRepoPath(t *testing.T) { assert.EqualValues(t, "./testdata/emptyrepo", getRocksRepoPath("./testdata/emptyrepo")) os.Setenv(repoRocksPathEnvVarName, "./other_repo") - // If env var is set, return it if manifets is missing in passed repo. + // If env var is set, return it if manifests is missing in passed repo. assert.EqualValues(t, "./other_repo", getRocksRepoPath("./testdata/emptyrepo")) // Return passed repo path, since manifest exists. Env var is ignored. assert.EqualValues(t, "./testdata/repo", getRocksRepoPath("./testdata/repo")) diff --git a/cli/running/process_controller.go b/cli/running/process_controller.go index b532ac8f8..17b0c8d83 100644 --- a/cli/running/process_controller.go +++ b/cli/running/process_controller.go @@ -86,7 +86,7 @@ func (pc *processController) StopWithSignal(waitTimeout time.Duration, stopSigna return nil } - // Сreate a channel to receive an indication of the termination + // Create a channel to receive an indication of the termination // of the Instance. waitDone := make(chan error, 1) go func() { diff --git a/cli/running/running.go b/cli/running/running.go index b82c328b0..373f88d03 100644 --- a/cli/running/running.go +++ b/cli/running/running.go @@ -916,13 +916,13 @@ func Logrotate(run *InstanceCtx) error { // Check returns the result of checking the syntax of the application file. func Check(cmdCtx *cmdcontext.CmdCtx, run *InstanceCtx) error { - var errbuff bytes.Buffer + var errBuff bytes.Buffer os.Setenv("TT_CLI_INSTANCE", run.InstanceScript) cmd := exec.Command(cmdCtx.Cli.TarantoolCli.Executable, "-e", checkSyntax) - cmd.Stderr = &errbuff + cmd.Stderr = &errBuff if err := cmd.Run(); err != nil { - return errors.New(errbuff.String()) + return errors.New(errBuff.String()) } return nil diff --git a/cli/running/testdata/signal_handling.py b/cli/running/testdata/signal_handling.py index a6e4e9c74..5c8f2eac2 100644 --- a/cli/running/testdata/signal_handling.py +++ b/cli/running/testdata/signal_handling.py @@ -1,7 +1,11 @@ -import signal, sys +import signal +import sys + +# cSpell:words signum def handler(signum, frame): print("sigusr1", flush=True) + def int_handler(signum, frame): print("interrupted", flush=True) sys.exit(10) diff --git a/cli/running/watchdog.go b/cli/running/watchdog.go index 80372e26a..c9c8655d1 100644 --- a/cli/running/watchdog.go +++ b/cli/running/watchdog.go @@ -170,7 +170,7 @@ func (wd *Watchdog) Start() error { return nil } -// startIntegrityChecks launches gorountine that performs periodic integrity checks. +// startIntegrityChecks launches goroutine that performs periodic integrity checks. func (wd *Watchdog) startIntegrityChecks(ctx context.Context) { ticker := time.NewTicker(wd.integrityCheckPeriod) diff --git a/cli/search/bundle_test.go b/cli/search/bundle_test.go index 3566f79c5..045e8b778 100644 --- a/cli/search/bundle_test.go +++ b/cli/search/bundle_test.go @@ -27,6 +27,7 @@ func TestFetchBundlesInfo(t *testing.T) { expectedBundles search.BundleInfoSlice errMsg string }{ + // spell-checker:disable "tcm_release_bundles": { program: search.ProgramTcm, platform: platformInfo{arch: "x86_64", os: util.OsLinux}, @@ -164,6 +165,7 @@ func TestFetchBundlesInfo(t *testing.T) { expectedQuery: "enterprise/release/linux/x86_64", errMsg: `failed to parse version "gc64-Ver3": format is not valid`, }, + // spell-checker:enable } opts := config.CliOpts{ diff --git a/cli/search/search_test.go b/cli/search/search_test.go index b3595eefa..dea8dd96a 100644 --- a/cli/search/search_test.go +++ b/cli/search/search_test.go @@ -131,21 +131,21 @@ func Test_GetCommitFromGitLocal(t *testing.T) { tests := []struct { name string link string - tarlink string + tarLink string hashes []string wantErr bool }{ { name: "hash should be found", link: extractedRepoPath, - tarlink: tarPath, + tarLink: tarPath, hashes: []string{"c779d17", "6a05d6a", "6f05cd1"}, wantErr: false, }, { name: "missing hash", link: extractedRepoPath, - tarlink: tarPath, + tarLink: tarPath, hashes: []string{"111111"}, wantErr: true, }, @@ -153,7 +153,7 @@ func Test_GetCommitFromGitLocal(t *testing.T) { for _, repo := range tests { t.Run(repo.name, func(t *testing.T) { - require.NoError(t, util.ExtractTar(repo.tarlink)) + require.NoError(t, util.ExtractTar(repo.tarLink)) for _, hash := range repo.hashes { _, err := GetCommitFromGitLocal(repo.link, hash) if (err != nil) != repo.wantErr { @@ -174,21 +174,21 @@ func Test_GetCommitFromGitRemote(t *testing.T) { tests := []struct { name string link string - tarlink string + tarLink string hashes []string wantErr bool }{ { name: "hash should be found", link: extractedRepoPath, - tarlink: tarPath, + tarLink: tarPath, hashes: []string{"c779d17", "6a05d6a", "6f05cd1"}, wantErr: false, }, { name: "missing hash", link: extractedRepoPath, - tarlink: tarPath, + tarLink: tarPath, hashes: []string{"111111"}, wantErr: true, }, @@ -196,7 +196,7 @@ func Test_GetCommitFromGitRemote(t *testing.T) { for _, repo := range tests { t.Run(repo.name, func(t *testing.T) { - require.NoError(t, util.ExtractTar(repo.tarlink)) + require.NoError(t, util.ExtractTar(repo.tarLink)) for _, hash := range repo.hashes { _, err := GetCommitFromGitRemote(repo.link, hash) if (err != nil) != repo.wantErr { diff --git a/cli/tail/tail_test.go b/cli/tail/tail_test.go index fe70e7421..ba8a5f229 100644 --- a/cli/tail/tail_test.go +++ b/cli/tail/tail_test.go @@ -191,7 +191,7 @@ five wantErr: false, }, { - name: "Only new-lines, wamt 3", + name: "Only new-lines, want 3", text: "\n\n\n\n\n\n\n\n\n", args: args{ n: 3, @@ -277,7 +277,7 @@ five wantErr: false, }, { - name: "Only new-lines, wamt 3", + name: "Only new-lines, want 3", text: "\n\n\n\n\n\n\n\n\n", args: args{ n: 3, diff --git a/cli/templates/internal/engines/go_text_engine.go b/cli/templates/internal/engines/go_text_engine.go index 5bd338964..c157d07c6 100644 --- a/cli/templates/internal/engines/go_text_engine.go +++ b/cli/templates/internal/engines/go_text_engine.go @@ -11,6 +11,8 @@ import ( type GoTextEngine struct{} +// spell-checker:ignore missingkey + // makeTemplate creates template for rendering. func makeTemplate(name string) *template.Template { state := newGenState() diff --git a/cli/util/git_test.go b/cli/util/git_test.go index 716a7a3f8..30ee42fcf 100644 --- a/cli/util/git_test.go +++ b/cli/util/git_test.go @@ -19,17 +19,17 @@ func Test_IsValidCommitHash(t *testing.T) { }, { "common git hash", - "168cf81ce2430ce3ad12f17c81eea3cd7e6bf54b", + "168cf81ce2430ce3ad12f17c81eea3cd7e6bf54b", // spell-checker:disable-line true, }, { "common git hash", - "954e256e6df0b402040091ee1bbc08624dfb72f8", + "954e256e6df0b402040091ee1bbc08624dfb72f8", // spell-checker:disable-line true, }, { "wrong hash", - "95965085ebed88eabd28cc3e83bdz9157391ac81", + "95965085ebed88eabd28cc3e83bdz9157391ac81", // spell-checker:disable-line false, }, { diff --git a/cli/util/util.go b/cli/util/util.go index 620fb486d..99fac3a66 100644 --- a/cli/util/util.go +++ b/cli/util/util.go @@ -706,8 +706,8 @@ func IsApp(path string) bool { if entry.IsDir() { // Check if the directory contains init.lua script or instances.yml file. - for _, fileTocheck := range [...]string{"init.lua", "instances.yml", "instances.yaml"} { - if fileInfo, err := os.Stat(filepath.Join(path, fileTocheck)); err == nil { + for _, fileToCheck := range [...]string{"init.lua", "instances.yml", "instances.yaml"} { + if fileInfo, err := os.Stat(filepath.Join(path, fileToCheck)); err == nil { if !fileInfo.IsDir() { return true } @@ -871,6 +871,7 @@ func InstantiateFileFromTemplate(templatePath, templateContent string, params an if err != nil { return fmt.Errorf("error parsing %s: %s", templatePath, err) } + // spell-checker:ignore missingkey parsedTemplate.Option("missingkey=error") // Treat missing variable as error. _, err = file.WriteString(unitContent) @@ -914,15 +915,15 @@ func CollectAppList(baseDir, appsPath string, verbose bool) ([]string, error) { } // RelativeToCurrentWorkingDir returns a path relative to current working dir. -// In case of error, fullpath is returned. -func RelativeToCurrentWorkingDir(fullpath string) string { +// In case of error, fullPath is returned. +func RelativeToCurrentWorkingDir(fullPath string) string { cwd, err := os.Getwd() if err != nil { - return fullpath + return fullPath } - relPath, err := filepath.Rel(cwd, fullpath) + relPath, err := filepath.Rel(cwd, fullPath) if err != nil { - return fullpath + return fullPath } return relPath } @@ -962,7 +963,7 @@ func CopyFileDeep(src, dst string) error { } // StringToTimestamp transforms string with number or RFC339Nano time -// to timestamp string. +// to timestamp string. func StringToTimestamp(input string) (string, error) { if input == "" { // Default value. diff --git a/cli/util/util_test.go b/cli/util/util_test.go index e10d362ae..1ba113cf3 100644 --- a/cli/util/util_test.go +++ b/cli/util/util_test.go @@ -725,6 +725,7 @@ func TestStringToTimestamp(t *testing.T) { output string wantErr bool }{ + // spell-checker:disable { "clean", "", @@ -785,6 +786,7 @@ func TestStringToTimestamp(t *testing.T) { "", true, }, + // spell-checker:enable } for _, tt := range tests { @@ -815,7 +817,7 @@ func TestIsURL(t *testing.T) { {"Invalid app:instance", "app:instance", false}, {"Empty string", "", false}, {"Array", "[one, two]", false}, - {"String", "invavid string", false}, + {"String", "invalid string", false}, {"UNIX", "unix:///var/run/tarantool/my_instance.sock", true}, } diff --git a/cli/version/version_match.go b/cli/version/version_match.go index 091b374ec..55e7a2d9f 100644 --- a/cli/version/version_match.go +++ b/cli/version/version_match.go @@ -47,7 +47,7 @@ func exploreMatchVersion(verStr string) (Version, requiredFields, error) { return version, fields, err } - version.BuildName = matches["buildname"] + version.BuildName = matches["buildName"] if version.BuildName != "" { fields = append(fields, requiredFieldBuildName) } diff --git a/cli/version/version_tools.go b/cli/version/version_tools.go index 81e7b76b4..4632f381f 100644 --- a/cli/version/version_tools.go +++ b/cli/version/version_tools.go @@ -81,7 +81,7 @@ func createVersionRegexp(isStrict bool) *regexp.Regexp { // Part 5 (optional) -> additional commits, // Part 6 (optional) -> commit hash and revision. // GC suffix is not saved, since it is not part of version. - matchString := `^((?P[^\d\.\+-].*)-)?` + + matchString := `^((?P[^\d\.\+-].*)-)?` + `v?(?:(?P\d+)){1}(?:\.(?P\d+)){1}(?:\.(?P\d+)){1}` + `(?:-(?Pentrypoint|rc|alpha|beta)(?P\d+)?)?` + `(?:-(?P\d+))?` + @@ -109,8 +109,8 @@ func Parse(verStr string) (Version, error) { return version, err } - if matches["buildname"] != "" { - version.BuildName = matches["buildname"] + if matches["buildName"] != "" { + version.BuildName = matches["buildName"] } if version.Major, err = util.AtoiUint64(matches["major"]); err != nil { diff --git a/lib/cluster/cluster_test.go b/lib/cluster/cluster_test.go index d251185a8..fa36bf2c7 100644 --- a/lib/cluster/cluster_test.go +++ b/lib/cluster/cluster_test.go @@ -312,7 +312,7 @@ func TestInstantiate_global(t *testing.T) { assertExpectedInstantiate(t, iconfig, expected) } -func TestInstantiate_inherbit(t *testing.T) { +func TestInstantiate_inherit(t *testing.T) { config := cluster.NewConfig() // Priority. config.Set([]string{"groups", "a", "replicasets", "b", "instances", "exist", "foo"}, 1) @@ -362,7 +362,7 @@ func TestReplaceInstanceConfig_not_found(t *testing.T) { assert.EqualError(t, err, "cluster configuration has not an instance \"any\"") } -func TestReplaceInstanceConfig_replcase(t *testing.T) { +func TestReplaceInstanceConfig_replicaset(t *testing.T) { path := []string{"groups", "a", "replicasets", "b", "instances", "c", "foo"} config := cluster.NewConfig() err := config.Set(path, 1) @@ -438,7 +438,7 @@ func TestFindGroupByReplicaset(t *testing.T) { found bool }{ {"b", "a", true}, - {"notexists", "", false}, + {"not_exists", "", false}, } for _, tc := range cases { group, found := cluster.FindGroupByReplicaset(clusterCfg, tc.replicaset) diff --git a/lib/cluster/datacollector_test.go b/lib/cluster/datacollector_test.go index 0b4283675..e8b76dc47 100644 --- a/lib/cluster/datacollector_test.go +++ b/lib/cluster/datacollector_test.go @@ -58,7 +58,7 @@ func TestDataCollectorFactory(t *testing.T) { } } -func TestDataCollectorFactorys_NewFile_not_exist(t *testing.T) { +func TestDataCollectorFactory_NewFile_not_exist(t *testing.T) { cases := []struct { Name string Factory cluster.DataCollectorFactory @@ -87,7 +87,7 @@ func TestDataCollectorFactorys_NewFile_not_exist(t *testing.T) { } } -func TestDataCollectorFactorys_NewFile_valid(t *testing.T) { +func TestDataCollectorFactory_NewFile_valid(t *testing.T) { expected := []cluster.Data{{ Source: testYamlPath, Value: []byte(`config: diff --git a/lib/cluster/etcd.go b/lib/cluster/etcd.go index 30be286cf..4ea80931a 100644 --- a/lib/cluster/etcd.go +++ b/lib/cluster/etcd.go @@ -502,6 +502,7 @@ func (publisher EtcdAllDataPublisher) Publish(revision int64, data []byte) error txn = txn.If(cmps...) } + // spell-checker:ignore tresp // And try to execute the transaction. tresp, err := txn.Then(opts...).Commit() if err != nil { @@ -758,7 +759,7 @@ func (publisher EtcdKeyDataPublisher) Publish(revision int64, data []byte) error } // loadRootCA and the code below is a copy-paste from Go sources. We need an -// ability to load ceritificates from a directory, but there is no such public +// ability to load certificates from a directory, but there is no such public // function in `crypto`. // // https://cs.opensource.google/go/go/+/refs/tags/go1.20.7:src/crypto/x509/root_unix.go;l=62-74 @@ -822,7 +823,7 @@ type ConnectOpts struct { } // connectEtcd establishes a connection to etcd. -func СonnectEtcdUriOpts( +func ConnectEtcdUriOpts( uriOpts libconnect.UriOpts, connOpts ConnectOpts, ) (*clientv3.Client, error) { @@ -849,12 +850,12 @@ func СonnectEtcdUriOpts( func DoOnStorage(connOpts ConnectOpts, opts libconnect.UriOpts, tarantoolFunc func(tarantool.Connector) error, etcdFunc func(*clientv3.Client) error, ) error { - etcdcli, errEtcd := СonnectEtcdUriOpts(opts, connOpts) + etcdcli, errEtcd := ConnectEtcdUriOpts(opts, connOpts) if errEtcd == nil { return etcdFunc(etcdcli) } - conn, errTarantool := СonnectTarantool(opts, connOpts) + conn, errTarantool := ConnectTarantool(opts, connOpts) if errTarantool == nil { return tarantoolFunc(conn) } diff --git a/lib/cluster/integration_test.go b/lib/cluster/integration_test.go index 882aadccf..1a3302a92 100644 --- a/lib/cluster/integration_test.go +++ b/lib/cluster/integration_test.go @@ -64,7 +64,7 @@ func doWithCtx(action func(context.Context) error) error { func startEtcd(t *testing.T, opts etcdOpts) integration.LazyCluster { t.Helper() - mydir, err := os.Getwd() + myDir, err := os.Getwd() if err != nil { t.Fatalf("Failed to get current working directory: %s", err) } @@ -73,15 +73,15 @@ func startEtcd(t *testing.T, opts etcdOpts) integration.LazyCluster { if opts.CaFile != "" || opts.CertFile != "" || opts.KeyFile != "" { tls = &transport.TLSInfo{} if opts.CaFile != "" { - caPath := filepath.Join(mydir, opts.CaFile) + caPath := filepath.Join(myDir, opts.CaFile) tls.TrustedCAFile = caPath } if opts.CertFile != "" { - certPath := filepath.Join(mydir, opts.CertFile) + certPath := filepath.Join(myDir, opts.CertFile) tls.CertFile = certPath } if opts.KeyFile != "" { - keyPath := filepath.Join(mydir, opts.KeyFile) + keyPath := filepath.Join(myDir, opts.KeyFile) tls.KeyFile = keyPath } } @@ -145,7 +145,7 @@ func startEtcd(t *testing.T, opts etcdOpts) integration.LazyCluster { func etcdPut(t *testing.T, etcd *clientv3.Client, key, value string) { t.Helper() var ( - presp *clientv3.PutResponse + presp *clientv3.PutResponse // spell-checker:ignore presp err error ) doWithCtx(func(ctx context.Context) error { @@ -273,10 +273,10 @@ func TestConnectEtcd(t *testing.T) { etcdPut(t, etcd, "foo", "bar") ctx, cancel := context.WithTimeout(context.Background(), timeout) - gresp, err := etcd.Get(ctx, "foo") + resp, err := etcd.Get(ctx, "foo") cancel() require.NoError(t, err) - require.NotNil(t, gresp) + require.NotNil(t, resp) }) } } @@ -725,6 +725,8 @@ var validCheckFunc = func(data []byte, hashes map[string][]byte, sig []byte) err return nil } +// spell-checker:ignore abcdefg qwertyuiop + func TestIntegrityDataPublisherKey_CollectorAll_valid(t *testing.T) { for _, test := range testsIntegrity { t.Run(test.Name, func(t *testing.T) { diff --git a/lib/cluster/tarantool.go b/lib/cluster/tarantool.go index ecdf8a6c9..5c9c93ac1 100644 --- a/lib/cluster/tarantool.go +++ b/lib/cluster/tarantool.go @@ -479,7 +479,7 @@ type tarantoolGetResponse struct { } } -// tarantoolCall retursns result of a function call via tarantool connector. +// tarantoolCall returns result of a function call via tarantool connector. func tarantoolCall(conn tarantool.Doer, fun string, args []any, timeout time.Duration, ) ([]any, error) { @@ -590,7 +590,7 @@ func MakeConnectOptsFromUriOpts(src libconnect.UriOpts) (tarantool.Dialer, taran return dialer, opts } -func СonnectTarantool(uriOpts libconnect.UriOpts, +func ConnectTarantool(uriOpts libconnect.UriOpts, connOpts ConnectOpts, ) (tarantool.Connector, error) { if uriOpts.Username == "" && uriOpts.Password == "" { diff --git a/lib/cluster/validators.go b/lib/cluster/validators.go index ab358d615..541123a35 100644 --- a/lib/cluster/validators.go +++ b/lib/cluster/validators.go @@ -187,12 +187,12 @@ type IntegerValidator struct{} func (validator IntegerValidator) Validate(value any) (any, error) { switch v := value.(type) { case string: - ivalue, err := strconv.ParseInt(v, 10, 64) + iValue, err := strconv.ParseInt(v, 10, 64) if err != nil { return nil, wrapValidateErrors([]string{}, fmt.Errorf(fmtParseFailed, fmt.Sprint(value), "integer")) } - return int(ivalue), nil + return int(iValue), nil case int, int8, int16, int32, int64: return int(reflect.ValueOf(v).Int()), nil case uint, uint8, uint16, uint32, uint64: @@ -354,7 +354,7 @@ func MakeRecordValidator(items map[string]Validator) RecordValidator { // Validate returns a validated record or an error. func (validator RecordValidator) Validate(value any) (any, error) { - vmap, ok := value.(map[any]any) + vMap, ok := value.(map[any]any) if !ok { return nil, wrapValidateErrors([]string{fmt.Sprint(value)}, fmt.Errorf("must be a map")) @@ -365,7 +365,7 @@ func (validator RecordValidator) Validate(value any) (any, error) { errs []error ) for k, validator := range validator.items { - if val, ok := vmap[k]; ok { + if val, ok := vMap[k]; ok { if ret, err := validator.Validate(val); err == nil { out[k] = ret } else { @@ -397,7 +397,7 @@ func MakeMapValidator(key, value Validator) MapValidator { // Validate returns a validated map or an error. func (validator MapValidator) Validate(value any) (any, error) { - vmap, ok := value.(map[any]any) + vMap, ok := value.(map[any]any) if !ok { return nil, wrapValidateErrors([]string{fmt.Sprint(value)}, fmt.Errorf("must be a map")) @@ -408,21 +408,21 @@ func (validator MapValidator) Validate(value any) (any, error) { errs []error ) - for key, value := range vmap { - rkey, err := validator.key.Validate(key) + for key, value := range vMap { + rKey, err := validator.key.Validate(key) if err != nil { err = wrapValidateErrors(nil, err) errs = append(errs, err) continue } - rvalue, err := validator.value.Validate(value) + rValue, err := validator.value.Validate(value) if err != nil { path := []string{fmt.Sprint(key)} err = wrapValidateErrors(path, err) errs = append(errs, err) continue } - out[rkey] = rvalue + out[rKey] = rValue } if len(errs) > 0 { diff --git a/lib/cluster/validators_test.go b/lib/cluster/validators_test.go index f3fd5ac75..2d1ab4375 100644 --- a/lib/cluster/validators_test.go +++ b/lib/cluster/validators_test.go @@ -10,6 +10,8 @@ import ( "github.com/tarantool/tt/lib/cluster" ) +// spell-checker:ignore zoozoo foofoo barbarbar foofoofoo + var ( _ cluster.Validator = cluster.AnyValidator{} _ cluster.Validator = cluster.StringValidator{} @@ -332,7 +334,7 @@ func TestSequenceValidator_empty(t *testing.T) { assert.NoError(t, err) } -func TestSequenctValidator_number_string(t *testing.T) { +func TestSequenceValidator_number_string(t *testing.T) { validator := cluster.MakeSequenceValidator( cluster.NumberValidator{}, cluster.StringValidator{}) @@ -775,7 +777,7 @@ func TestMapValidator_string_array_allowed(t *testing.T) { assert.NoError(t, err) } -func TestMapValidator_interger_record(t *testing.T) { +func TestMapValidator_integer_record(t *testing.T) { value, err := cluster.MakeMapValidator( cluster.IntegerValidator{}, cluster.MakeRecordValidator(map[string]cluster.Validator{ diff --git a/lib/cluster/yaml.go b/lib/cluster/yaml.go index 5fa9504ca..78a3654b3 100644 --- a/lib/cluster/yaml.go +++ b/lib/cluster/yaml.go @@ -63,7 +63,7 @@ type YamlCollectorDecorator struct { rawCollector DataCollector } -// Collect collects configuration from raw data interpretening it +// Collect collects configuration from raw data interpreting it // as YAML. func (collector YamlCollectorDecorator) Collect() (*Config, error) { raw, err := collector.rawCollector.Collect() diff --git a/lib/connect/uri.go b/lib/connect/uri.go index c89cd2288..8a99c6fdb 100644 --- a/lib/connect/uri.go +++ b/lib/connect/uri.go @@ -19,7 +19,7 @@ const ( const ( // userPathRe is a regexp for a username:password pair. - userpassRe = `[^@:/]+:[^@:/]+` + userPassRe = `[^@:/]+:[^@:/]+` // uriPathPrefixRe is a regexp for a path prefix in uri, such as `scheme://path``. uriPathPrefixRe = `((~?/+)|((../+)*))?` @@ -128,20 +128,20 @@ func IsCredentialsURI(str string) bool { // tcp://user:password@host:port // user:password@host:port hostReStr := `(?:([\w\\.-]+)|(\[[\w:%]+\]))` - tcpReStr := `(tcp://)?` + userpassRe + `@(` + hostReStr + `:\d+)` + tcpReStr := `(tcp://)?` + userPassRe + `@(` + hostReStr + `:\d+)` // unix://user:password@../path // unix://user:password@~/path // unix://user:password@/path // unix://user:password@path - unixReStr := `unix://` + userpassRe + `@` + uriPathPrefixRe + `[^\./@]+.*` + unixReStr := `unix://` + userPassRe + `@` + uriPathPrefixRe + `[^\./@]+.*` // user:password@../path // user:password@~/path // user:password@/path // user:password@./path - pathReStr := userpassRe + `@` + systemPathPrefixRe + `[^\./].*` + pathReStr := userPassRe + `@` + systemPathPrefixRe + `[^\./].*` // https://user:password@host:port // https://user:password@host - httpsReStr := `(http|https)://` + userpassRe + `@([\w\.-]+(:\d+)?)(/[\w\-\./~]*)?` + httpsReStr := `(http|https)://` + userPassRe + `@([\w\.-]+(:\d+)?)(/[\w\-\./~]*)?` uriReStr := "^((" + tcpReStr + ")|(" + httpsReStr + ")|(" + unixReStr + ")|(" + pathReStr + "))$" uriRe := regexp.MustCompile(uriReStr) @@ -187,7 +187,7 @@ func ParseCredentialsURI(str string) (string, string, string) { return str, "", "" } - re := regexp.MustCompile(userpassRe + `@`) + re := regexp.MustCompile(userPassRe + `@`) // Split the string into two parts by credentials to create a string // without the credentials. split := re.Split(str, 2) diff --git a/lib/connect/uri_test.go b/lib/connect/uri_test.go index a03b0457a..f77424415 100644 --- a/lib/connect/uri_test.go +++ b/lib/connect/uri_test.go @@ -9,6 +9,8 @@ import ( "github.com/tarantool/tt/lib/connect" ) +// spell-checker:ignore kfile + const ( testUser = "a-фs$d!e%*1#2?3&44" testPass = "bb-фs$d!e%*1#2?3&666" diff --git a/lib/integrity/repository.go b/lib/integrity/repository.go index 457e2b711..f3aedfe97 100644 --- a/lib/integrity/repository.go +++ b/lib/integrity/repository.go @@ -3,7 +3,7 @@ package integrity import "io" // Repository provides utilities for working with files and -// ensuring that they were not compomised. +// ensuring that they were not compromised. type Repository interface { // Read makes sure the file is not modified and reads it. Read(path string) (io.ReadCloser, error) diff --git a/magefile.go b/magefile.go index 4492a6b11..e9544dce2 100644 --- a/magefile.go +++ b/magefile.go @@ -16,6 +16,8 @@ import ( "github.com/magefile/mage/sh" ) +// spell-checker:ignore trimpath extldflags asmflags covdata GOEXE TTEXE GOCOVERDIR + const ( buildTypeEnv = "TT_CLI_BUILD_SSL" goPackageName = "github.com/tarantool/tt/cli" @@ -331,8 +333,8 @@ type Unit mg.Namespace func runUnitTests(flags []string) error { mg.Deps(GenerateGoCode) - testdirs := append([]string{"."}, modules...) - for _, module := range testdirs { + testDirs := append([]string{"."}, modules...) + for _, module := range testDirs { args := []string{"test", "-C", module} if mg.Verbose() { args = append(args, "-v") @@ -453,11 +455,11 @@ func IntegrationNoTarantool() error { "test/integration") } -// Run codespell checks. -func Codespell() error { - fmt.Println("Running codespell tests...") +// Run code spell checks. +func CodeSpell() error { + fmt.Println("Running code spell tests...") - return sh.RunV("codespell", ".") + return sh.RunV("codespell", ".") // spell-checker:disable-line } // Run all tests together, excluding slow and unit integration tests. diff --git a/magefile.publish.go b/magefile.publish.go index 0a85f6dc1..6a7309bc2 100644 --- a/magefile.publish.go +++ b/magefile.publish.go @@ -71,7 +71,7 @@ func walkMatch(root string, patterns []string) ([]string, error) { return matches, nil } -// getPatterns returns patterns to select goreleaser build artifacts. +// getPatterns returns patterns to select go releaser build artifacts. func getPatterns(distro Distro) ([]string, error) { if distro.OS == "el" || distro.OS == "fedora" || distro.OS == "linux-rpm" { return []string{"*.rpm"}, nil diff --git a/test/cartridge_helper.py b/test/cartridge_helper.py index fdfeeef4c..88d76f335 100644 --- a/test/cartridge_helper.py +++ b/test/cartridge_helper.py @@ -162,7 +162,7 @@ def __init__(self, workdir, tt_cmd) -> None: def truncate(self, bootstrap_vshard=True): self.stop() shutil.rmtree(os.path.join(self.workdir, cartridge_name, var_path)) - self.start(boostrap_vshard=bootstrap_vshard) + self.start(bootstrap_vshard=bootstrap_vshard) def create(self): cmd = [self.tt_cmd, "create", "-s", "cartridge", "--name", cartridge_name, "-f"] @@ -182,7 +182,7 @@ def build(self): assert rc == 0 assert re.search(r"Application was successfully built", out) - def start(self, boostrap_vshard=True): + def start(self, bootstrap_vshard=True): start_cmd = [self.tt_cmd, "start", cartridge_name] test_env = os.environ.copy() # Avoid too long path. @@ -195,7 +195,7 @@ def start(self, boostrap_vshard=True): wait_inst_start(self.workdir, inst) # Bootstrap. - self.bootstrap(bootstrap_vshard=boostrap_vshard) + self.bootstrap(bootstrap_vshard=bootstrap_vshard) def bootstrap(self, bootstrap_vshard=True): cmd = [self.tt_cmd, "replicaset", "bootstrap", cartridge_name] diff --git a/test/conftest.py b/test/conftest.py index 23c3a98a3..ef693a715 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -83,7 +83,7 @@ def tt_cmd(tmp_path_factory: TempPathFactory, request: pytest.FixtureRequest) -> tt_path = tt_build_dir / "tt" build_env = os.environ.copy() - build_env["TTEXE"] = str(tt_path) + build_env["TTEXE"] = str(tt_path) # cSpell:words TTEXE build_env.setdefault("TT_CLI_BUILD_SSL", "static") process = subprocess.run(["mage", "-v", "build"], cwd=tt_base_path, env=build_env, text=True) @@ -140,7 +140,7 @@ def stop_etcd_children(): etcd_instance.stop() # Additionally, we stop all etcd children; - # Finalizer may execute while ectd is starting. + # Finalizer may execute while etcd is starting. me = psutil.Process() utils.kill_procs(list(filter(lambda p: p.name() == "etcd", me.children()))) diff --git a/test/etcd_helper.py b/test/etcd_helper.py index 314ea9fe9..222f482c8 100644 --- a/test/etcd_helper.py +++ b/test/etcd_helper.py @@ -63,7 +63,7 @@ def truncate(self): raise ex def enable_auth(self): - # etcdv3 client have a bug that prevents to establish a connection with + # etcd v3 client have a bug that prevents to establish a connection with # authentication enabled in latest python versions. So we need a separate steps # to upload/fetch data to/from etcd via the client. try: diff --git a/test/integration/cat/test_cat.py b/test/integration/cat/test_cat.py index 2a0c2d4aa..49294c3dd 100644 --- a/test/integration/cat/test_cat.py +++ b/test/integration/cat/test_cat.py @@ -57,7 +57,7 @@ def test_cat_args_tests_failed(tt_cmd, tmp_path, args, expected_error): ), ], ) -def test_cat_args_tests_successed(tt_cmd, tmp_path, args, expected): +def test_cat_args_tests_succeeded(tt_cmd, tmp_path, args, expected): # Copy the .xlog file to the "run" directory. test_data = Path(__file__).parent / "test_file" shutil.copy(test_data / "test.xlog", tmp_path) @@ -86,7 +86,7 @@ def test_cat_args_tests_successed(tt_cmd, tmp_path, args, expected): ), ], ) -def test_cat_directories_tests_successed(tt_cmd, tmp_path: Path, args, expected): +def test_cat_directories_tests_succeeded(tt_cmd, tmp_path: Path, args, expected): # Copy files to the "run" directory. shutil.copytree(Path(__file__).parent / "test_file", tmp_path / "test_file") @@ -132,7 +132,7 @@ def test_cat_test_timestamp_failed(tt_cmd, tmp_path, input, error): "2024-11-14T14:02:35+00:00", ], ) -def test_cat_test_timestamp_successed(tt_cmd, tmp_path, input): +def test_cat_test_timestamp_succeeded(tt_cmd, tmp_path, input): # Copy the .xlog file to the "run" directory. test_app_path = os.path.join(os.path.dirname(__file__), "test_file", "timestamp.xlog") shutil.copy(test_app_path, tmp_path) diff --git a/test/integration/cfg/test_dump.py b/test/integration/cfg/test_dump.py index 6627e1b12..439c54ea9 100644 --- a/test/integration/cfg/test_dump.py +++ b/test/integration/cfg/test_dump.py @@ -11,9 +11,9 @@ def test_cfg_dump_default(tt_cmd, tmp_path): os.path.join(tmp_path, config_name), ) - buid_cmd = [tt_cmd, "cfg", "dump"] + cmd = [tt_cmd, "cfg", "dump"] tt_process = subprocess.Popen( - buid_cmd, + cmd, cwd=tmp_path, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -45,9 +45,9 @@ def test_cfg_dump_raw(tt_cmd, tmp_path): os.path.join(tmp_path, config_name), ) - buid_cmd = [tt_cmd, "cfg", "dump", "--raw"] + cmd = [tt_cmd, "cfg", "dump", "--raw"] tt_process = subprocess.Popen( - buid_cmd, + cmd, cwd=tmp_path, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -77,9 +77,9 @@ def test_cfg_dump_raw(tt_cmd, tmp_path): def test_cfg_dump_no_config(tt_cmd, tmp_path): - buid_cmd = [tt_cmd, "cfg", "dump", "--raw"] + cmd = [tt_cmd, "cfg", "dump", "--raw"] tt_process = subprocess.Popen( - buid_cmd, + cmd, cwd=tmp_path, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, diff --git a/test/integration/cli/test_launch.py b/test/integration/cli/test_launch.py index 64a26ee72..3bbae19a0 100644 --- a/test/integration/cli/test_launch.py +++ b/test/integration/cli/test_launch.py @@ -223,7 +223,7 @@ def test_launch_local_tarantool_missing_in_bin_dir(tt_cmd, tmp_path): os.mkdir(tmp_path / "binaries") - commands_intmp = [ + commands_in_tmp = [ [tt_cmd, "run", "--version"], ] @@ -232,7 +232,7 @@ def test_launch_local_tarantool_missing_in_bin_dir(tt_cmd, tmp_path): [tt_cmd, "--cfg", config_path, "run", "--version"], ] - for cmd in commands_intmp: + for cmd in commands_in_tmp: rc, output = run_command_and_get_output(cmd, cwd=tmp_path) # Missing binaries is not a error. Default Tarantool is used. assert rc == 0 diff --git a/test/integration/cluster/test_cluster_promote.py b/test/integration/cluster/test_cluster_promote.py index 2c15cc8b9..a30c4dd05 100644 --- a/test/integration/cluster/test_cluster_promote.py +++ b/test/integration/cluster/test_cluster_promote.py @@ -192,6 +192,9 @@ def test_cluster_promote_single_key( assert content == expected +# cSpell:words lexi + + @pytest.mark.parametrize( "instance_name, data_dir, exp_key, err_text", [ diff --git a/test/integration/cluster/test_cluster_publish.py b/test/integration/cluster/test_cluster_publish.py index d0f649063..6a3e6cde5 100644 --- a/test/integration/cluster/test_cluster_publish.py +++ b/test/integration/cluster/test_cluster_publish.py @@ -91,6 +91,9 @@ def test_cluster_publish_in_place_instances_enabled(tt_cmd, tmp_path): assert f.read() == cfg +# cSpell:words testsimpleapp + + @pytest.mark.parametrize("app_name", ["test_simple_app", "testsimpleapp"]) def test_cluster_publish_no_configuration(tt_cmd, tmpdir_with_cfg, app_name): tmpdir = tmpdir_with_cfg @@ -381,7 +384,7 @@ def test_cluster_publish_wrong_replicaset_name(tt_cmd, tmpdir_with_cfg, app_name "cluster", "publish", "--replicaset", - "unexist", + "noexist", f"{app_name}:master", "src.yaml", ] @@ -394,7 +397,7 @@ def test_cluster_publish_wrong_replicaset_name(tt_cmd, tmpdir_with_cfg, app_name ) publish_output = instance_process.stdout.read() - expected = ' ⨯ wrong replicaset name, expected "replicaset-001", have "unexist"' + expected = ' ⨯ wrong replicaset name, expected "replicaset-001", have "noexist"' assert expected in publish_output @@ -412,7 +415,7 @@ def test_cluster_publish_wrong_group_name(tt_cmd, tmpdir_with_cfg, app_name): "cluster", "publish", "--group", - "unexist", + "noexist", f"{app_name}:master", "src.yaml", ] @@ -425,7 +428,7 @@ def test_cluster_publish_wrong_group_name(tt_cmd, tmpdir_with_cfg, app_name): ) publish_output = instance_process.stdout.read() - expected = ' ⨯ wrong group name, expected "group-001", have "unexist"' + expected = ' ⨯ wrong group name, expected "group-001", have "noexist"' assert expected in publish_output diff --git a/test/integration/cluster/test_cluster_show.py b/test/integration/cluster/test_cluster_show.py index 25cffc170..45576e011 100644 --- a/test/integration/cluster/test_cluster_show.py +++ b/test/integration/cluster/test_cluster_show.py @@ -79,6 +79,9 @@ def test_cluster_show_config_not_exist_app(tt_cmd, tmpdir_with_cfg): assert expected in show_output +# cSpell:words testsimpleapp + + @pytest.mark.parametrize( "app_name, config_file", [ diff --git a/test/integration/completion/conftest.py b/test/integration/completion/conftest.py index 5494a69aa..4a8eee342 100644 --- a/test/integration/completion/conftest.py +++ b/test/integration/completion/conftest.py @@ -28,6 +28,8 @@ def completion(tt_cmd: Path, tmp_path_factory: pytest.TempPathFactory, request) process = run(cmd, text=True, capture_output=True) assert process.returncode == 0, f"Failed to generate {shell} completion script for testing." + # cSpell:words getbasetemp + completion_file = tmp_path_factory.getbasetemp() / f"tt_completion.{shell}" completion_file.write_text(process.stdout) @@ -44,7 +46,7 @@ def skip_no_helpers(request: pytest.FixtureRequest, completion: Completion) -> N def pytest_configure(config): - config.addinivalue_line( + config.addinivalue_line( # cSpell:words addinivalue "markers", "skip_unimplemented: skip test if no helper script implemented for this shell", ) diff --git a/test/integration/connect/test_connect.py b/test/integration/connect/test_connect.py index 4a83c1200..1b00a1cbf 100644 --- a/test/integration/connect/test_connect.py +++ b/test/integration/connect/test_connect.py @@ -37,6 +37,8 @@ def kill_remain_processes_wrapper(tt_cmd): # Run test. yield + # cSpell:words pgrep + tt_proc = subprocess.Popen(["pgrep", "-f", tt_cmd], stdout=subprocess.PIPE, shell=False) response = tt_proc.communicate()[0] procs = [psutil.Process(int(pid)) for pid in response.split()] @@ -3199,6 +3201,9 @@ def test_set_delimiter(tt_cmd, tmpdir_with_cfg, instance: str, opts: None | dict stop_app(tt_cmd, tmpdir, "test_app") +# cSpell:words seqscan, evalers + + @pytest.mark.skipif(tarantool_major_version == 1, reason="skip custom evaler test for Tarantool 1") def test_custom_evaler(tt_cmd, tmpdir_with_cfg): tmpdir = tmpdir_with_cfg diff --git a/test/integration/coredump/test_coredump.py b/test/integration/coredump/test_coredump.py index 493283dfb..898283ec8 100644 --- a/test/integration/coredump/test_coredump.py +++ b/test/integration/coredump/test_coredump.py @@ -9,6 +9,8 @@ from utils import get_tarantool_version, run_command_and_get_output +# cSpell:words getrlimit setrlimit rlimit, rlim, coredumps, coredumpctl, apport + # Fixture below produces a coredump. The location of the coredumps is # configured over /proc/sys/kernel/core_pattern file in a various ways # but this fixture recognizes only some of them for now: @@ -46,6 +48,7 @@ def coredump_systemd(core_source, outdir): to_coredump = None if not core_pattern.startswith("|"): core_wildcard = core_pattern.replace("%%", "%") + # cspell:disable-next-line core_wildcard = re.sub("%[cdeEghiIpPstu]", "*", core_wildcard) if not os.path.isabs(core_wildcard): core_wildcard = str(coredump_dir / core_wildcard) @@ -185,7 +188,7 @@ def test_coredump_unpack_no_arg(tt_cmd, tmp_path): def test_coredump_unpack_no_such_file(tt_cmd, tmp_path): - cmd = [tt_cmd, "coredump", "unpack", "file_that_doesnt_exist"] + cmd = [tt_cmd, "coredump", "unpack", "file_that_does_not_exist"] rc, output = run_command_and_get_output(cmd, cwd=tmp_path) assert rc != 0 assert re.search(r"failed to unpack", output) @@ -207,7 +210,7 @@ def test_coredump_inspect_no_arg(tt_cmd, tmp_path): def test_coredump_inspect_no_such_file(tt_cmd, tmp_path): - cmd = [tt_cmd, "coredump", "inspect", "file_that_doesnt_exist"] + cmd = [tt_cmd, "coredump", "inspect", "file_that_does_not_exist"] rc, output = run_command_and_get_output(cmd, cwd=tmp_path) assert rc != 0 assert re.search(r"failed to inspect", output) diff --git a/test/integration/create/test_create.py b/test/integration/create/test_create.py index 09f483c52..cfab968f1 100644 --- a/test/integration/create/test_create.py +++ b/test/integration/create/test_create.py @@ -197,7 +197,7 @@ def test_vars_passed_from_cli(tt_cmd, tmp_path): assert out_lines[i].find(expected_lines[i]) != -1 -def test_noninteractive_mode(tt_cmd, tmp_path): +def test_not_interactive_mode(tt_cmd, tmp_path): create_tnt_env_in_dir(tmp_path) create_cmd = [ @@ -350,6 +350,7 @@ def run_and_check_non_interactive(tt_cmd, tmp_path, template_path, template_name def test_template_as_archive(tt_cmd, tmp_path): create_tnt_env_in_dir(tmp_path) + # cSpell:disable-next-line pack_template_cmd = ["tar", "-czvf", "../luakit.tgz", "./"] tar_process = subprocess.Popen( pack_template_cmd, @@ -399,6 +400,7 @@ def test_template_search_paths(tt_cmd, tmp_path): os.mkdir(tmp_path / "templates2") os.mkdir(tmp_path / "templates3") + # cSpell:disable-next-line pack_template_cmd = ["tar", "-czvf", (tmp_path / "templates3" / "luakit.tgz").as_posix(), "./"] tar_process = subprocess.Popen( pack_template_cmd, @@ -756,7 +758,7 @@ def test_create_app_from_builtin_cartridge_template(tt_cmd, tmp_path): assert data_loaded["app1.router"]["http_port"] == 8081 -def test_create_app_from_builtin_cartridge_template_noninteractive(tt_cmd, tmp_path): +def test_create_app_from_builtin_cartridge_template_not_interactive(tt_cmd, tmp_path): with open(os.path.join(tmp_path, config_name), "w") as tnt_env_file: tnt_env_file.write(tt_config_text.format(tmp_path)) @@ -790,6 +792,7 @@ def test_create_app_from_builtin_cartridge_template_with_dst_specified(tt_cmd, t with open(os.path.join(tmp_path, config_name), "w") as tnt_env_file: tnt_env_file.write(tt_config_text.format(tmp_path)) + # cSpell:words appdir create_cmd = [tt_cmd, "create", "cartridge", "--name", "app1", "--dst", "appdir"] tt_process = subprocess.Popen( create_cmd, @@ -1041,7 +1044,7 @@ def select_data_func(): with open(os.path.join(tmp_path, "app1", inst, "tt.log")) as f: print(inst, f.read()) - # Stop the vhsard_cluster app. + # Stop the vshard_cluster app. stop_cmd = [tt_cmd, "stop", "--yes", "app1"] stop_rc, stop_out = run_command_and_get_output(stop_cmd, cwd=tmp_path) assert stop_rc == 0 @@ -1052,7 +1055,7 @@ def select_data_func(): print("\n".join(f.readlines())) # Assert here to be sure that instances are stopped. assert can_insert, "can not insert data into the vshard cluster" - assert can_select, "can not select data from the vhsard cluster" + assert can_select, "can not select data from the vshard cluster" def check_create(tt_cmd, workdir, template, app_name, params, files): diff --git a/test/integration/daemon/test_daemon.py b/test/integration/daemon/test_daemon.py index 95797da69..59087c977 100644 --- a/test/integration/daemon/test_daemon.py +++ b/test/integration/daemon/test_daemon.py @@ -14,12 +14,14 @@ # In case of unsuccessful completion of tests, tarantool test # daemon/instance may remain running. -# This is autorun wrapper for each test case in this module. +# This is auto run wrapper for each test case in this module. @pytest.fixture(autouse=True) def kill_remain_processes_wrapper(tt_cmd): # Run test. yield + # cSpell:words pgrep + # Kill a test daemon/instance if it was not stopped due to a failed test. tt_proc = subprocess.Popen(["pgrep", "-f", tt_cmd], stdout=subprocess.PIPE, shell=False) response = tt_proc.communicate()[0] @@ -276,6 +278,8 @@ def test_daemon_http_requests_with_cfg(tt_cmd, tmpdir_with_cfg): conn = utils.get_process_conn(os.path.join(tmp_path, utils.run_path, file), port) assert conn is not None + # cSpell:words laddr + url = "http://" + conn.laddr.ip + ":" + str(port) + "/tarantool" body = {"command_name": "start", "params": ["test_app"]} diff --git a/test/integration/env/test_env.py b/test/integration/env/test_env.py index 04a7706d3..0d3aa3a02 100644 --- a/test/integration/env/test_env.py +++ b/test/integration/env/test_env.py @@ -21,7 +21,7 @@ def test_env_output(tt_cmd, tmp_path): text=True, ) - # Check that the process shutdowned correctly. + # Check that the process shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc == 0 diff --git a/test/integration/init/test_init.py b/test/integration/init/test_init.py index 64e8b8b8b..9df876129 100644 --- a/test/integration/init/test_init.py +++ b/test/integration/init/test_init.py @@ -287,6 +287,7 @@ def test_init_basic_tarantoolctl_cfg(tt_cmd, tmp_path): check_env_dirs(tmp_path, "instances.enabled") +# cSpell:words ttctl def test_tarantoolctl_cfg_from_doc(tt_cmd, tmp_path): shutil.copy( os.path.join(os.path.dirname(__file__), "configs", "default_ttctl_cfg_from_doc.lua"), diff --git a/test/integration/install/test_install.py b/test/integration/install/test_install.py index fe8d4edbc..8db82ddf0 100644 --- a/test/integration/install/test_install.py +++ b/test/integration/install/test_install.py @@ -12,7 +12,7 @@ @pytest.mark.slow -def test_install_tt_unexisted_commit(tt_cmd, tmp_path): +def test_install_tt_noexist_commit(tt_cmd, tmp_path): configPath = os.path.join(tmp_path, config_name) # Create test config @@ -42,7 +42,7 @@ def test_install_tt_unexisted_commit(tt_cmd, tmp_path): text=True, ) - # Check that the process shutdowned correctly. + # Check that the process shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc != 0 @@ -69,7 +69,7 @@ def test_install_tt(tt_cmd, tmp_path): text=True, ) - # Check that the process shutdowned correctly. + # Check that the process shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc == 0 os.remove(configPath) @@ -103,7 +103,7 @@ def test_install_uninstall_tt_specific_commit(tt_cmd, tmp_path): text=True, ) - # Check that the process shutdowned correctly. + # Check that the process shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc == 0 @@ -152,7 +152,7 @@ def test_wrong_format_hash(tt_cmd, tmp_path): text=True, ) - # Check that the process shutdowned correctly. + # Check that the process shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc != 0 assert re.search(r"Searching in versions...", instance_process.stdout.readline()) @@ -172,7 +172,7 @@ def test_wrong_format_hash(tt_cmd, tmp_path): text=True, ) - # Check that the process shutdowned correctly. + # Check that the process shutdown correctly. instance_process_rc = instance_process_second.wait() assert instance_process_rc != 0 first_output = instance_process_second.stdout.readline() @@ -206,7 +206,7 @@ def test_install_tt_specific_version(tt_cmd, tmp_path, required_ver: str, instal text=True, ) - # Check that the process shutdowned correctly. + # Check that the process shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc == 0 os.remove(configPath) @@ -245,7 +245,7 @@ def test_install_tarantool_commit(tt_cmd, tmp_path): text=True, ) - # Check that the process was shutdowned correctly. + # Check that the process was shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc == 0 installed_cmd = [tmp_path / "bin" / "tarantool", "-v"] @@ -299,7 +299,7 @@ def test_install_tarantool(tt_cmd, tmp_path, required_ver: str, installed_ver: s text=True, ) - # Check that the process was shutdowned correctly. + # Check that the process was shutdown correctly. instance_process_rc = instance_process.wait() assert instance_process_rc == 0 installed_cmd = [tmp_path / "bin" / "tarantool", "-v"] @@ -357,6 +357,7 @@ def test_install_tarantool_in_docker(tt_cmd, tmp_path): run_output = installed_program_process.stdout.readline() assert re.search(r"Tarantool", run_output) + # cSpell:words objdump # Check tarantool glibc version. out = subprocess.getoutput( "objdump -T " @@ -755,7 +756,7 @@ def test_install_tt_fetch_latest_version( with open(config_path, "w") as f: f.write("env:\n bin_dir: \n inc_dir:\n") - # Create executalbe file with 'tt version --commit' + # Create executable file with 'tt version --commit' # functionality to emulate real work of tt. We need # the following to avoid a situation where the last # git commit in the master branch makes it impossible diff --git a/test/integration/pack/test_pack.py b/test/integration/pack/test_pack.py index e8307e0d6..ca981f654 100644 --- a/test/integration/pack/test_pack.py +++ b/test/integration/pack/test_pack.py @@ -18,6 +18,8 @@ # Tests # # ##### # +# cSpell:words jrei getgid + def get_arch(): process = subprocess.Popen( @@ -699,7 +701,7 @@ def test_pack_tgz_missing_app(tt_cmd, tmp_path): base_dir = tmp_path rc, output = run_command_and_get_output( - [tt_cmd, "pack", "tgz", "--app-list", "unexisting-app"], + [tt_cmd, "pack", "tgz", "--app-list", "non-existing-app"], cwd=base_dir, env=dict(os.environ, PWD=base_dir), ) @@ -2268,7 +2270,7 @@ def test_pack_ignore(tt_cmd, tmp_path): "deep/nested/subdir/name1", "subdir2/name1/file", "name2", - "subdir/name3_blabla", + "subdir/name3_blabla", # cSpell:words blabla "dir1/file", "subdir/dir1/file", "dir2/file", diff --git a/test/integration/replicaset/test_replicaset_bootstrap.py b/test/integration/replicaset/test_replicaset_bootstrap.py index 6dea2d85e..4fda46eb7 100644 --- a/test/integration/replicaset/test_replicaset_bootstrap.py +++ b/test/integration/replicaset/test_replicaset_bootstrap.py @@ -36,10 +36,10 @@ def test_bootstrap_no_instance(tt_cmd, tmpdir_with_cfg): app_path = os.path.join(tmpdir, app_name) shutil.copytree(os.path.join(os.path.dirname(__file__), app_name), app_path) - status_cmd = [tt_cmd, "rs", "bootstrap", "test_custom_app:unexist"] + status_cmd = [tt_cmd, "rs", "bootstrap", "test_custom_app:noexist"] rc, out = run_command_and_get_output(status_cmd, cwd=tmpdir_with_cfg) assert rc == 1 - assert re.search(r" ⨯ instance \"unexist\" not found", out) + assert re.search(r" ⨯ instance \"noexist\" not found", out) @pytest.mark.skipif(tarantool_major_version > 2, reason="skip custom test for Tarantool > 2") diff --git a/test/integration/replicaset/test_replicaset_expel.py b/test/integration/replicaset/test_replicaset_expel.py index 35cf5ac82..532e966f5 100644 --- a/test/integration/replicaset/test_replicaset_expel.py +++ b/test/integration/replicaset/test_replicaset_expel.py @@ -40,10 +40,10 @@ def test_expel_no_instance(tt_cmd, tmpdir_with_cfg): app_path = os.path.join(tmpdir, app_name) shutil.copytree(os.path.join(os.path.dirname(__file__), app_name), app_path) - status_cmd = [tt_cmd, "replicaset", "expel", "test_custom_app:unexist"] + status_cmd = [tt_cmd, "replicaset", "expel", "test_custom_app:noexist"] rc, out = run_command_and_get_output(status_cmd, cwd=tmpdir_with_cfg) assert rc == 1 - assert re.search(r" ⨯ instance \"unexist\" not found", out) + assert re.search(r" ⨯ instance \"noexist\" not found", out) @pytest.mark.skipif(tarantool_major_version > 2, reason="skip custom test for Tarantool > 2") @@ -117,7 +117,7 @@ def test_expel_cartridge(tt_cmd, cartridge_app): Roles: vshard-storage ★ s2-master localhost:3304 rw """ - status_unexpelled = status_expelled + " • s2-replica localhost:3305 read\n" + status_not_expelled = status_expelled + " • s2-replica localhost:3305 read\n" # Wait for the configured state. for _ in range(100): @@ -140,7 +140,7 @@ def test_expel_cartridge(tt_cmd, cartridge_app): """ • Discovery application...* """ - + status_unexpelled + + status_not_expelled + """\n • Expel instance: s2-replica • Done.* """, @@ -152,7 +152,7 @@ def test_expel_cartridge(tt_cmd, cartridge_app): rs_cmd = [tt_cmd, "replicaset", "status", f"{cartridge_name}:s2-master"] rs_rc, rs_out = run_command_and_get_output(rs_cmd, cwd=cartridge_app.workdir) assert rs_rc == 0 - if rs_out != status_unexpelled: + if rs_out != status_not_expelled: # Changes are not applied immediately on the whole cluster. break time.sleep(1) diff --git a/test/integration/replicaset/test_replicaset_promote.py b/test/integration/replicaset/test_replicaset_promote.py index 74e055802..e29b43eff 100644 --- a/test/integration/replicaset/test_replicaset_promote.py +++ b/test/integration/replicaset/test_replicaset_promote.py @@ -155,7 +155,7 @@ def test_promote_cconfig_failovers( "manual-failover-2", "election-failover-1", "election-failover-2", - "eleciton-failover-3", + "eleciton-failover-3", # spell-checker:disable-line ], ), ) diff --git a/test/integration/replicaset/test_replicaset_vshard.py b/test/integration/replicaset/test_replicaset_vshard.py index a5e658a08..15e579ca5 100644 --- a/test/integration/replicaset/test_replicaset_vshard.py +++ b/test/integration/replicaset/test_replicaset_vshard.py @@ -45,10 +45,10 @@ def test_vshard_bootstrap_no_instance(tt_cmd, tmpdir_with_cfg): app_path = os.path.join(tmpdir, app_name) shutil.copytree(os.path.join(os.path.dirname(__file__), app_name), app_path) - status_cmd = [tt_cmd, "rs", "vs", "bootstrap", "test_custom_app:unexist"] + status_cmd = [tt_cmd, "rs", "vs", "bootstrap", "test_custom_app:noexist"] rc, out = run_command_and_get_output(status_cmd, cwd=tmpdir_with_cfg) assert rc == 1 - assert re.search(r" ⨯ instance \"unexist\" not found", out) + assert re.search(r" ⨯ instance \"noexist\" not found", out) @pytest.mark.skipif(tarantool_major_version > 2, reason="skip custom test for Tarantool > 2") @@ -312,7 +312,7 @@ def stop_and_clean(): tarantool_major_version < 3, reason="skip centralized config test for Tarantool < 3", ) -def test_vshard_bootstrap_enought_timeout(tt_cmd, vshard_cconfig_app_timeout_tt_env): +def test_vshard_bootstrap_enough_timeout(tt_cmd, vshard_cconfig_app_timeout_tt_env): tmpdir = vshard_cconfig_app_timeout_tt_env cmd_sleep = ["sleep", "0.5"] @@ -335,7 +335,7 @@ def test_vshard_bootstrap_enought_timeout(tt_cmd, vshard_cconfig_app_timeout_tt_ tarantool_major_version < 3, reason="skip centralized config test for Tarantool < 3", ) -def test_vshard_bootstrap_not_enought_timeout(tt_cmd, vshard_cconfig_app_timeout_tt_env): +def test_vshard_bootstrap_not_enough_timeout(tt_cmd, vshard_cconfig_app_timeout_tt_env): tmpdir = vshard_cconfig_app_timeout_tt_env cmd_sleep = ["sleep", "0.5"] @@ -346,6 +346,8 @@ def test_vshard_bootstrap_not_enought_timeout(tt_cmd, vshard_cconfig_app_timeout cmd.append("--config") cmd.append(vshard_cconfig_app_name_timeout) + # cSpell:words configdata + rc, out = run_command_and_get_output(cmd, cwd=tmpdir) assert rc == 1 assert "failed to bootstrap vshard" in out diff --git a/test/integration/rocks/test_rocks.py b/test/integration/rocks/test_rocks.py index f658a664e..ddb2b8d31 100644 --- a/test/integration/rocks/test_rocks.py +++ b/test/integration/rocks/test_rocks.py @@ -328,6 +328,9 @@ def test_rock_install_with_non_system_tarantool_in_path(tt_cmd, tmpdir_with_tara assert os.path.exists(os.path.join(tmp_path, ".rocks", "share", "tarantool", "crud")) +# cSpell:words DENABLE + + @pytest.mark.docker def test_rocks_with_hardcoded(tt_cmd, tmp_path): if shutil.which("docker") is None: diff --git a/test/integration/running/test_running.py b/test/integration/running/test_running.py index a77cab3e9..9b3cb56f5 100644 --- a/test/integration/running/test_running.py +++ b/test/integration/running/test_running.py @@ -386,9 +386,9 @@ def test_running_reread_config(tt_cmd, tmp_path): isStarted = wait_instance_start(log_file_path) assert isStarted is True # Kill instance child process. - killed_childrens = 0 - while killed_childrens == 0: - killed_childrens = kill_child_process(pid) + killed_children = 0 + while killed_children == 0: + killed_children = kill_child_process(pid) # Wait for child process of instance to start again. # It is indicated by 'started' in logs last line. @@ -406,9 +406,9 @@ def test_running_reread_config(tt_cmd, tmp_path): yaml.dump({"app": {"restart_on_failure": False}}, file) # Kill instance child process. - killed_childrens = 0 - while killed_childrens == 0: - killed_childrens = kill_child_process(pid) + killed_children = 0 + while killed_children == 0: + killed_children = kill_child_process(pid) pid_path = os.path.join(tmp_path, "test_app", run_path, "test_app", pid_file) # Wait for instance to shutdown, since instance now should shutdown after failure. stopped = wait_instance_stop(pid_path) @@ -767,7 +767,7 @@ def rename(): # SIGQUIT tests are skipped, because they cause coredump generation, which cannot be disabled -# with process limits setting for some coredump patterns (using systemd-coderump). +# with process limits setting for some coredump patterns (using systemd-coredump). @pytest.mark.parametrize( "cmd,input", [ diff --git a/test/integration/search/test_search.py b/test/integration/search/test_search.py index 896095461..f0d925794 100644 --- a/test/integration/search/test_search.py +++ b/test/integration/search/test_search.py @@ -31,6 +31,7 @@ def test_version_cmd(tt_cmd, tmp_path): @pytest.mark.parametrize( "program,versions", + # cSpell:disable [ ( "tarantool-ee", @@ -54,6 +55,7 @@ def test_version_cmd(tt_cmd, tmp_path): ], ), ], + # cSpell:enable ) def test_local_repo_sdk(tt_cmd: Path, tmp_path: Path, program: str, versions: list[str]) -> None: configPath = Path(__file__).parent / "testdata" / config_name diff --git a/test/integration/ttbuild/test_build.py b/test/integration/ttbuild/test_build.py index 6a52fc1cd..d2d883a41 100644 --- a/test/integration/ttbuild/test_build.py +++ b/test/integration/ttbuild/test_build.py @@ -14,9 +14,9 @@ def test_build_no_options(tt_cmd, tmpdir_with_cfg): os.path.join(tmpdir_with_cfg, "app1"), ) - buid_cmd = [tt_cmd, "build"] + build_cmd = [tt_cmd, "build"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=app_dir, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -43,9 +43,9 @@ def test_build_with_tt_hooks(tt_cmd, tmpdir_with_cfg): dirs_exist_ok=True, ) - buid_cmd = [tt_cmd, "build"] + build_cmd = [tt_cmd, "build"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=app_dir, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -73,9 +73,9 @@ def test_build_with_cartridge_hooks(tt_cmd, tmpdir_with_cfg): dirs_exist_ok=True, ) - buid_cmd = [tt_cmd, "build"] + build_cmd = [tt_cmd, "build"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=app_dir, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -98,9 +98,9 @@ def test_build_app_name_set(tt_cmd, tmpdir_with_cfg): os.path.join(tmpdir_with_cfg, "app1"), ) - buid_cmd = [tt_cmd, "build", "app1"] + build_cmd = [tt_cmd, "build", "app1"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=tmpdir_with_cfg, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -122,9 +122,9 @@ def test_build_absolute_path(tt_cmd, tmpdir_with_cfg): ) with tempfile.TemporaryDirectory() as tmpWorkDir: - buid_cmd = [tt_cmd, "--cfg", os.path.join(tmpdir_with_cfg, config_name), "build", app_dir] + build_cmd = [tt_cmd, "--cfg", os.path.join(tmpdir_with_cfg, config_name), "build", app_dir] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=tmpWorkDir, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -157,9 +157,9 @@ def test_build_error_omit_stdout(tt_cmd, tmpdir_with_cfg): def test_build_missing_rockspec(tt_cmd, tmpdir_with_cfg): - buid_cmd = [tt_cmd, "build"] + build_cmd = [tt_cmd, "build"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=tmpdir_with_cfg, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -179,9 +179,9 @@ def test_build_missing_rockspec(tt_cmd, tmpdir_with_cfg): def test_build_missing_app_dir(tt_cmd, tmpdir_with_cfg): - buid_cmd = [tt_cmd, "build", "app1"] + build_cmd = [tt_cmd, "build", "app1"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=tmpdir_with_cfg, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -196,9 +196,9 @@ def test_build_missing_app_dir(tt_cmd, tmpdir_with_cfg): def test_build_multiple_paths(tt_cmd, tmpdir_with_cfg): - buid_cmd = [tt_cmd, "build", "app1", "app2"] + build_cmd = [tt_cmd, "build", "app1", "app2"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=tmpdir_with_cfg, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, @@ -218,9 +218,9 @@ def test_build_spec_file_set(tt_cmd, tmpdir_with_cfg): os.path.join(tmpdir_with_cfg, "app1"), ) - buid_cmd = [tt_cmd, "build", "app1", "--spec", "app1-scm-1.rockspec"] + build_cmd = [tt_cmd, "build", "app1", "--spec", "app1-scm-1.rockspec"] tt_process = subprocess.Popen( - buid_cmd, + build_cmd, cwd=tmpdir_with_cfg, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, diff --git a/test/tt_helper.py b/test/tt_helper.py index 958148f0b..7935d6c27 100644 --- a/test/tt_helper.py +++ b/test/tt_helper.py @@ -116,10 +116,10 @@ def wal_files(tt, instances): return [tt.lib_path(inst, "*.xlog") for inst in instances] -def wait_box_status(timeout, tt, instances, accepatable_statuses, interval=0.1): - def are_all_box_statuses_acceptable(tt, instances, accepatable_statuses): +def wait_box_status(timeout, tt, instances, acceptable_statuses, interval=0.1): + def are_all_box_statuses_acceptable(tt, instances, acceptable_statuses): status_ = status(tt) - return all([(status_[inst].get("BOX") in accepatable_statuses) for inst in instances]) + return all([(status_[inst].get("BOX") in acceptable_statuses) for inst in instances]) return utils.wait_event( timeout, @@ -127,7 +127,7 @@ def are_all_box_statuses_acceptable(tt, instances, accepatable_statuses): interval, tt, instances, - accepatable_statuses, + acceptable_statuses, ) diff --git a/test/utils.py b/test/utils.py index 97705188b..f559de93e 100644 --- a/test/utils.py +++ b/test/utils.py @@ -413,6 +413,7 @@ def is_ipv4_type(address): def get_test_iface(): + # cSpell:words ifaces, addrs, ifaddresses ifaces = netifaces.interfaces() for iface in ifaces[1:]: @@ -435,6 +436,7 @@ def proc_by_pidfile(filename): def get_process_conn(pidfile, port): + # cSpell:words laddr proc = proc_by_pidfile(pidfile) for conn in proc.connections(): if conn.status == "LISTEN" and conn.laddr.port == port and is_ipv4_type(conn.laddr.ip): @@ -548,8 +550,8 @@ def read_kv(dirname): def is_tarantool_less_3(): - major_versoin, _ = get_tarantool_version() - return True if major_versoin < 3 else False + major_version, _ = get_tarantool_version() + return True if major_version < 3 else False def is_tarantool_ee():