[flake test] reconfig application organization

Aperta
#331 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@MayRosenbaum ci sta già lavorando.

Dal 30/11/2026.

  • #332 di @MayRosenbaum — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
73/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
testing

Direzione di ricerca

Start with integration/test/reconfig_app_org_test.go and integration/test/block_query_client.go; read the two checks after PullFromAssemblers and how PullBlocks reads blockchain height. Confirm whether TotalBlocks includes the genesis block, then add a height wait before both checks and handle PullBlocks errors on the test goroutine. Run TestReconfigAppOrg and verify it waits for the committer while still detecting missing transactions.

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

Descrizione

TestReconfigAppOrg fails intermittently. It checks the committer's blocks right after the orderer delivers them, without waiting for the committer to commit them.

Failing runs

All three fail the same way:

utils.go:848: Finished pull and count: blocks 2, txs 11 from party: 1
reconfig_app_org_test.go:95: Blockchain height: 1
    expected: 11
    actual  : 1
    Messages: number of envelopes does not match number of transactions sent
--- FAIL: TestReconfigAppOrg (26.90s)
Cause
  • The test waits until the assemblers deliver all the blocks (reconfig_app_org_test.go#L95), then calls requireCommitterEnvelopes right away (#L96).
  • PullBlocks reads the committer's height once and fetches only that many blocks (block_query_client.go#L47-L56).
  • If the committer hasn't committed block 1 yet, its height is 1. The test then gets only the genesis block, with its one envelope, and fails. Re-runs pass, so the committer does commit the block; the test reads its height too early.
  • verifyPostReconfigBlocks has the same race after the reconfig (#L336).
Proposed fix

Wait until the committer reaches the orderer's height before checking its blocks:

  • testutils.PullFromAssemblers returns each party's BlockPullerInfo, whose TotalBlocks is the number of blocks the orderer delivered.
  • Add BlockQueryClient.WaitForHeight, which polls GetBlockchainInfo until the committer's height reaches that number.
  • Call it before requireCommitterEnvelopes and before verifyPostReconfigBlocks. For the second, submitPeerOrgReconfig returns the block count of its own PullFromAssemblers call (#L318).
// WaitForHeight waits until the committer's height reaches height.
func (c *BlockQueryClient) WaitForHeight(t *testing.T, ctx context.Context, height uint64) {
	t.Helper()
	client, conn := c.createClient(t)
	defer conn.Close()
	require.EventuallyWithT(t, func(ct *assert.CollectT) {
		info, err := (*client).GetBlockchainInfo(ctx, &emptypb.Empty{})
		require.NoError(ct, err)
		require.GreaterOrEqual(ct, info.GetHeight(), height)
	}, time.Minute, 100*time.Millisecond)
}
info := testutils.PullFromAssemblers(t, pullOpts(totalTxNumber, nil))
blockQueryClient.WaitForHeight(t, ctx, uint64(info[parties[0]].TotalBlocks))
requireCommitterEnvelopes(t, blockQueryClient, totalTxNumber)

The assertions stay exact: if the committer loses a transaction, the test still fails, after the wait.

To confirm while fixing: that TotalBlocks counts the genesis block, as the committer's height does. The failing log suggests it does: the assemblers report 2 blocks, and the committer was at height 1 with only block 0.

Also

PullBlocks calls require.NoError(t, …) inside its goroutine (block_query_client.go#L58). t.FailNow must run on the test's goroutine, so a failed fetch there doesn't stop the test properly. The goroutine should return the error to the caller instead.

Lingua principale
Go
Stelle
65
Fork
85
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 hyperledger/fabric-x

Tutte le issue di hyperledger/fabric-x

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.