Skip to content

Commit 96bb340

Browse files
committed
ci: display port usage information
It might help to identify the reason of flaky test `test_replicaset_bootstrap_cartridge_app_second_bootstrap` when/if it fails next time. Needed for #TNTP-3709
1 parent 350bf7c commit 96bb340

File tree

8 files changed

+102
-27
lines changed

8 files changed

+102
-27
lines changed

.github/workflows/full-ci.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,27 @@ jobs:
4040
with:
4141
tarantool-version: '${{ matrix.tarantool-version }}'
4242

43-
- name: Static code check
44-
uses: ./.github/actions/static-code-check
43+
# - name: Static code check
44+
# uses: ./.github/actions/static-code-check
4545

46-
- name: Unit tests
47-
run: mage unitfull
46+
# - name: Unit tests
47+
# run: mage unitfull
4848

4949
# This server starts and listen on 8084 port that is used for tests.
5050
- name: Stop Mono server
51-
run: sudo systemctl kill mono-xsp4 || true
51+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
52+
run: |
53+
sudo netstat -tupln
54+
sudo systemctl kill mono-xsp4 || echo "failed to kill mono-xsp4 (exit status $?)"
5255
5356
- name: Integration tests
5457
env:
5558
TT_ENABLE_COREDUMP_TESTS: '1'
56-
run: mage integrationfull
59+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
60+
run: |
61+
sudo netstat -tupln
62+
while mage integrationfull; do echo "test succeed, trying another attempt..."; done
63+
# mage integrationfull || { sudo netstat -tupln; exit 1; }
5764

5865
full-ci-ce-linux-arm64:
5966
if: false
@@ -132,20 +139,27 @@ jobs:
132139
sdk-version: '${{ matrix.sdk-version }}'
133140
sdk-download-token: '${{ secrets.SDK_DOWNLOAD_TOKEN }}'
134141

135-
- name: Static code check
136-
uses: ./.github/actions/static-code-check
142+
# - name: Static code check
143+
# uses: ./.github/actions/static-code-check
137144

138-
- name: Unit tests
139-
run: mage unitfull
145+
# - name: Unit tests
146+
# run: mage unitfull
140147

141148
# This server starts and listen on 8084 port that is used for tests.
142149
- name: Stop Mono server
143-
run: sudo systemctl kill mono-xsp4 || true
150+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
151+
run: |
152+
sudo netstat -tupln
153+
sudo systemctl kill mono-xsp4 || echo "failed to kill mono-xsp4 (exit status $?)"
144154
145155
- name: Integration tests
146156
env:
147157
TT_ENABLE_COREDUMP_TESTS: '1'
148-
run: mage integrationfull
158+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
159+
run: |
160+
sudo netstat -tupln
161+
while mage integrationfull; do echo "test succeed, trying another attempt..."; done
162+
# mage integrationfull || { sudo netstat -tupln; exit 1; }
149163

150164
full-ci-macOS:
151165
if: false

.github/workflows/tests.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,25 @@ jobs:
4848
with:
4949
tarantool-version: '${{ matrix.tarantool-version }}'
5050

51-
- name: Static code check
52-
uses: ./.github/actions/static-code-check
51+
# - name: Static code check
52+
# uses: ./.github/actions/static-code-check
5353

54-
- name: Unit tests
55-
run: mage unit
54+
# - name: Unit tests
55+
# run: mage unit
5656

5757
# This server starts and listen on 8084 port that is used for tests.
5858
- name: Stop Mono server
59-
run: sudo systemctl kill mono-xsp4 || true
59+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
60+
run: |
61+
sudo netstat -tupln
62+
sudo systemctl kill mono-xsp4 || echo "failed to kill mono-xsp4 (exit status $?)"
6063
6164
- name: Integration tests
62-
run: mage integration
65+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
66+
run: |
67+
sudo netstat -tupln
68+
while mage integration; do echo "test succeed, trying another attempt..."; done
69+
# mage integration || { sudo netstat -tupln; exit 1; }
6370

6471
tests-ce-linux-arm64:
6572
if: false
@@ -138,18 +145,25 @@ jobs:
138145
sdk-version: '${{ matrix.sdk-version }}'
139146
sdk-download-token: '${{ secrets.SDK_DOWNLOAD_TOKEN }}'
140147

141-
- name: Static code check
142-
uses: ./.github/actions/static-code-check
148+
# - name: Static code check
149+
# uses: ./.github/actions/static-code-check
143150

144-
- name: Unit tests
145-
run: mage unit
151+
# - name: Unit tests
152+
# run: mage unit
146153

147154
# This server starts and listen on 8084 port that is used for tests.
148155
- name: Stop Mono server
149-
run: sudo systemctl kill mono-xsp4 || true
156+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
157+
run: |
158+
sudo netstat -tupln
159+
sudo systemctl kill mono-xsp4 || echo "failed to kill mono-xsp4 (exit status $?)"
150160
151161
- name: Integration tests
152-
run: mage integration
162+
# netstat is used to help find the cause of TNTP-3709, remove it as soon as it's found.
163+
run: |
164+
sudo netstat -tupln
165+
while mage integration; do echo "test succeed, trying another attempt..."; done
166+
# mage integration || { sudo netstat -tupln; exit 1; }
153167

154168
tests-mac-os-ce:
155169
if: false

cli/replicaset/cartridge.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,10 @@ func (c *CartridgeApplication) bootstrapInstance(instanceName, replicasetName st
498498
UUID: &replicasetUUID,
499499
JoinServers: joinOpts,
500500
}}
501+
fmt.Println("bootstrapInstance: opts:")
502+
for i, opt := range opts {
503+
fmt.Printf("[%d]: %+v\n", i, opt)
504+
}
501505
return cartridgeEditReplicasets(evaler, opts, timeout)
502506
}
503507

@@ -562,6 +566,7 @@ func getCartridgeJoinServersOpts(instancesCfg map[string]cartridgeInstanceConfig
562566
if _, UUIDExists := instancesUUID[instance]; UUIDExists {
563567
continue
564568
}
569+
fmt.Printf("getCartridgeJoinServersOpts: uuid is missing for instance ''%s\n", instance)
565570
cfg, found := instancesCfg[instance]
566571
if !found {
567572
return nil, fmt.Errorf("instance %q not found in the instance config", instance)
@@ -583,17 +588,39 @@ func updateCartridgeReplicasets(evaler connector.Evaler, discovered Replicasets,
583588
instancesCfg map[string]cartridgeInstanceConfig,
584589
timeout int,
585590
) error {
591+
fmt.Println("updateCartridgeReplicasets: replicasetCfg:")
592+
for k, v := range replicasetCfg {
593+
fmt.Printf(" %s: %+v\n", k, v)
594+
}
595+
fmt.Println("updateCartridgeReplicasets: instancesCfg:")
596+
for k, v := range instancesCfg {
597+
fmt.Printf(" %s: %+v\n", k, v)
598+
}
599+
586600
instanceUUID := map[string]string{}
587601
replicasetUUID := map[string]string{}
602+
fmt.Println("updateCartridgeReplicasets: setup UUID maps")
588603
for _, replicaset := range discovered.Replicasets {
604+
fmt.Printf(" %s: %s\n", replicaset.Alias, replicaset.UUID)
589605
replicasetUUID[replicaset.Alias] = replicaset.UUID
590606
for _, instance := range replicaset.Instances {
607+
fmt.Printf(" %s: %s\n", instance.Alias, instance.UUID)
591608
instanceUUID[instance.Alias] = instance.UUID
592609
}
593610
}
611+
fmt.Println("updateCartridgeReplicasets: replicasetUUID:")
612+
for k, v := range replicasetUUID {
613+
fmt.Printf(" %s: %s\n", k, v)
614+
}
615+
fmt.Println("updateCartridgeReplicasets: instanceUUID:")
616+
for k, v := range instanceUUID {
617+
fmt.Printf(" %s: %s\n", k, v)
618+
}
594619

620+
fmt.Println("updateCartridgeReplicasets: collect editOpts:")
595621
var editOpts []cartridgeEditReplicasetsOpts
596622
for rname, rcfg := range replicasetCfg {
623+
fmt.Printf(" %s: %+v\n", rname, rcfg)
597624
replicasetName := rname
598625
opts := cartridgeEditReplicasetsOpts{
599626
Alias: &replicasetName,
@@ -605,9 +632,11 @@ func updateCartridgeReplicasets(evaler connector.Evaler, discovered Replicasets,
605632
if uuid, found := replicasetUUID[replicasetName]; found {
606633
// Link opts to the existing replicaset.
607634
// admin_edit_topology() recognizes replicasets by UUID.
635+
fmt.Printf(" found replicaset uuid %s\n", uuid)
608636
opts.UUID = &uuid
609637
}
610638
var err error
639+
611640
opts.JoinServers, err = getCartridgeJoinServersOpts(instancesCfg,
612641
rcfg.Instances, instanceUUID)
613642
if err != nil {
@@ -625,6 +654,10 @@ func updateCartridgeReplicasets(evaler connector.Evaler, discovered Replicasets,
625654
editOpts = append(editOpts, opts)
626655
}
627656

657+
fmt.Println("updateCartridgeReplicasets: editOpts:")
658+
for i, opt := range editOpts {
659+
fmt.Printf("[%d]: %+v\n", i, opt)
660+
}
628661
return cartridgeEditReplicasets(evaler, editOpts, timeout)
629662
}
630663

cli/replicaset/lua/cartridge/edit_replicasets_body.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ local res, err = cartridge.admin_edit_topology({
55
replicasets = replicasets
66
})
77

8-
assert(res, tostring(err))
8+
assert(res, string.format("err:%s replicasets:%s", tostring(err), tostring(replicasets)))

magefile.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,18 @@ func (Unit) Coverage() error {
420420
func Integration() error {
421421
fmt.Println("Running integration tests...")
422422

423+
test_name := "test_replicaset_bootstrap_cartridge_app_second_bootstrap"
423424
return sh.RunV(pythonExecutableName, "-m", "pytest", "-m", "not slow and not slow_ee "+
424-
"and not notarantool", "test/integration")
425+
"and not notarantool", "-k", test_name, "test/integration")
425426
}
426427

427428
// Run full set of integration tests.
428429
func IntegrationFull() error {
429430
fmt.Println("Running all integration tests...")
430431

432+
test_name := "test_replicaset_bootstrap_cartridge_app_second_bootstrap"
431433
return sh.RunV(pythonExecutableName, "-m", "pytest", "-m", "not slow_ee and not notarantool",
432-
"test/integration")
434+
"-k", test_name, "test/integration")
433435
}
434436

435437
// Run full set of integration tests, excluding docker tests.

test/cartridge_helper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ def create(self):
175175
# Set replicasets config.
176176
with open(os.path.join(self.workdir, cartridge_name, "replicasets.yml"), "w") as f:
177177
f.write(yaml.dump(self.replicasets_cfg))
178+
with open(os.path.join(self.workdir, cartridge_name, "instances.yml"), "r") as f:
179+
print(f"CartridgeApp.create: instances.yml:\n{f.read()}")
180+
with open(os.path.join(self.workdir, cartridge_name, "replicasets.yml"), "r") as f:
181+
print(f"CartridgeApp.create: replicasets.yml:\n{f.read()}")
178182

179183
def build(self):
180184
cmd = [self.tt_cmd, "build", cartridge_name]

test/integration/replicaset/test_replicaset_bootstrap.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,14 @@ def test_replicaset_bootstrap_cartridge_app_second_bootstrap(tt_cmd, cartridge_a
159159
"vshard_group": "default",
160160
},
161161
}
162+
with open(os.path.join(cartridge_app.workdir, cartridge_name, "instances.yml"), "r") as f:
163+
print(f"test: instances.yml:\n{f.read()}")
164+
with open(os.path.join(cartridge_app.workdir, cartridge_name, "replicasets.yml"), "r") as f:
165+
print(f"test: replicasets.yml #1:\n{f.read()}")
162166
with open(os.path.join(cartridge_app.workdir, cartridge_name, "replicasets.yml"), "w") as f:
163167
f.write(yaml.dump(replicasets_cfg))
168+
with open(os.path.join(cartridge_app.workdir, cartridge_name, "replicasets.yml"), "r") as f:
169+
print(f"test: replicasets.yml #2:\n{f.read()}")
164170

165171
# Run bootstrap after initial bootstrap again.
166172
cmd = [tt_cmd, "rs", "bootstrap"]

test/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,11 @@ def find_ports(n=1, port=8000):
446446
if s.connect_ex(("localhost", port)) == 0:
447447
busy = True
448448
break
449+
print(f"find_ports({n}): is port {port} busy... {busy}")
449450
if not busy:
450451
ports.append(port)
451452
port += 1
453+
print(f"find_ports({n}): {ports}")
452454
return ports
453455

454456

0 commit comments

Comments
 (0)