test-run:create_cluster and test-run:cmd args duplication

Aperta
#347 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
lua, python
Ambito
testing

Direzione di ricerca

Reproduce the duplication with test/replication/gh-5445-leader-inconsistency.test.lua, using both test_run:create_cluster and test_run:cmd. Trace how their args are assembled before election_replica.lua receives them. Done means the final argument appears once and omitted arguments retain their intended defaults.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Adding following line at the top of tarantool/test/replication/election_replica.lua

print('DEBUG', require'yaml'.encode(arg))

And running gh-5445-leader-inconsistency.test.lua

Produces following log when test_run:create_cluster(SERVERS, "replication", {args='2 0.4'}) is called:

DEBUG   ---
0: election_replica1.lua
1: '2'
2: '0.4'
4: '0.4'
-1: /home/boris/dev/github/tarantool/tarantool/build/src/tarantool
...

And following, when test_run:cmd('start server '..other..' with args="1 0.4 voter 2"') is called:

DEBUG   ---
0: election_replica1.lua
1: '1'
2: '0.4'
3: voter
4: '2'
6: '2'
-1: /home/boris/dev/github/tarantool/tarantool/build/src/tarantool
...

The problem is last (N'th) argument is passed twice (as N' and N'th+2), this leads to incorrect default values handling in my case, when I add following changes, and expect 'off' as the default value for 5th argument:

diff --git a/test/replication/election_replica.lua b/test/replication/election_replica.lua
index 4848775f2..2ae29877a 100644
--- a/test/replication/election_replica.lua
+++ b/test/replication/election_replica.lua
@@ -6,7 +6,7 @@ local SYNCHRO_QUORUM = arg[1] and tonumber(arg[1]) or 3
 local ELECTION_TIMEOUT = arg[2] and tonumber(arg[2]) or 0.1
 local ELECTION_MODE = arg[3] or 'candidate'
 local CONNECT_QUORUM = arg[4] and tonumber(arg[4]) or 3
-local ELECTION_FENCING_ENABLED = arg[5] and true or false
+local ELECTION_FENCING_MODE = arg[5] or 'off'

 local function instance_uri(instance_id)
     return SOCKET_DIR..'/election_replica'..instance_id..'.sock';
@@ -25,7 +25,7 @@ box.cfg({
     replication_connect_quorum = CONNECT_QUORUM,
     election_mode = ELECTION_MODE,
     election_timeout = ELECTION_TIMEOUT,
-    election_fencing_enabled = ELECTION_FENCING_ENABLED,
+    election_fencing_mode = ELECTION_FENCING_MODE,
     replication_synchro_quorum = SYNCHRO_QUORUM,
     replication_synchro_timeout = 0.1,
     -- To reveal more election logs.

Call like test_run:cmd('start server '..leader..' with args="3 0.4 voter"') leads to 'voter' being passed as arg[5] and tarantool replica reporting:

[001] Configuration failed: Incorrect value for option 'election_fencing_mode': the value must be one of the following strings: 'off', 'soft', 'strict'
Lingua principale
Python
Stelle
13
Fork
19
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tarantool/test-run

Tutte le issue di tarantool/test-run

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.