Skip to content

Commit

Permalink
test_imds_tracer: check bcc-tools working before deploying aws-imds-p…
Browse files Browse the repository at this point in the history
…acket-analyzer

Signed-off-by: Xiao Liang <[email protected]>
  • Loading branch information
liangxiao1 committed Sep 20, 2024
1 parent d7ae6d0 commit a071ae7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion os_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.3.0'
__codedate__ = '20240912'
__codedate__ = '20240920'
12 changes: 12 additions & 0 deletions os_tests/data/baseline_log.json
Original file line number Diff line number Diff line change
Expand Up @@ -2277,5 +2277,17 @@
"cases": "os_tests.tests.test_general_test.TestGeneralTest.test_cpu_hotplug_no_workload",
"addedby": "[email protected]",
"addeddate": "20240909"
},
"msg_245": {
"content": ".*error: invalid application of.*sizeof.*to an incomplete type .*truct bpf_wq.*",
"analyze": "known issue",
"branch": "rhel10",
"status": "active",
"link": "https://issues.redhat.com/browse/RHEL-50531",
"path": "",
"trigger": "",
"cases": "os_tests.tests.test_general_test.TestGeneralTest.test_imds_tracer",
"addedby": "[email protected]",
"addeddate": "20240918"
}
}
17 changes: 13 additions & 4 deletions os_tests/libs/utils_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1976,17 +1976,26 @@ def imds_tracer_tool(test_instance=None, log_check=True, timeout=610, interval=3
return False
else:
test_instance.skipTest('only support imdsv2 on aws')
is_pkg_installed(test_instance, pkg_name="bcc-tools", cancel_case=is_return, timeout=600)
is_pkg_installed(test_instance, pkg_name="libbpf", cancel_case=is_return, timeout=600)
is_pkg_installed(test_instance, pkg_name="git", cancel_case=is_return)
bpf_test_cmd = "sudo timeout 60 /usr/share/bcc/tools/tcpsubnet"
ret = run_cmd(test_instance, bpf_test_cmd, msg='check if bcc-tools work', ret_status=True)
if ret != 124:
if is_return:
test_instance.log.info('please check whether bcc-tools works')
return False
else:
test_instance.fail('bcc-tools does not work')
ret = run_cmd(test_instance, 'systemctl status imds_tracer_tool.service', ret_status=True)
if ret != 0:
if cleanup:
test_instance.log.info("imds_tracer_tool service is not enabled, no need to cleanup")
return True
is_pkg_installed(test_instance, pkg_name="bcc-tools", cancel_case=is_return, timeout=600)
is_pkg_installed(test_instance, pkg_name="libbpf", cancel_case=is_return, timeout=600)
is_pkg_installed(test_instance, pkg_name="git", cancel_case=is_return)
is_cmd_exist(test_instance, 'python3')
run_cmd(test_instance, 'sudo rm -rf aws-imds-packet-analyzer')
run_cmd(test_instance, 'git clone --branch xiliang https://github.com/liangxiao1/aws-imds-packet-analyzer.git')
#run_cmd(test_instance, 'git clone --branch xiliang https://github.com/liangxiao1/aws-imds-packet-analyzer.git')
run_cmd(test_instance, 'git clone https://github.com/aws/aws-imds-packet-analyzer.git')
run_cmd(test_instance, 'cd aws-imds-packet-analyzer; sudo ./activate-tracer-service.sh')
time.sleep(30)
ret = run_cmd(test_instance, 'systemctl status imds_tracer_tool.service', ret_status=True)
Expand Down
4 changes: 2 additions & 2 deletions os_tests/tests/test_general_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ def test_check_dmesg_calltrace(self):
test_check_dmesg_calltrace
component:
kernel
bugzilla_id:
1777179
bug_id:
bugzilla_1777179,bugzilla_1627644,bugzilla_2091523,jira_RHEL-21709
is_customer_case:
False
maintainer:
Expand Down
3 changes: 1 addition & 2 deletions os_tests/tests/test_general_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@ def test_imds_tracer(self):
Check there is no process using imdsv1 to access instance metadata
key_steps: |
- sudo yum -y install bcc-tools libbpf
- git clone --branch xiliang https://github.com/liangxiao1/aws-imds-packet-analyzer.git (with the latest fix)
source repo: https://github.com/aws/aws-imds-packet-analyzer.git
- git clone https://github.com/aws/aws-imds-packet-analyzer.git (with the latest fix)
- sudo aws-imds-packet-analyzer/activate-tracer-service.sh
- sudo cat /var/log/imds/imds-trace.log|grep imdsv1
expected_result: |
Expand Down
2 changes: 1 addition & 1 deletion os_tests/tests/test_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_boot_debugkernel(self):
expect_kw='debug',
msg="checking debug kernel booted")
utils_lib.run_cmd(self, 'sudo dmesg', expect_ret=0, msg="saving dmesg output")
cmd = 'journalctl > /tmp/journalctl.log'
cmd = 'journalctl -b0 > /tmp/journalctl.log'
utils_lib.run_cmd(self, cmd, expect_ret=0, msg="saving journalctl output")
utils_lib.run_cmd(self, 'cat /tmp/journalctl.log', expect_ret=0)
utils_lib.run_cmd(self, "sudo systemd-analyze blame > /tmp/blame.log")
Expand Down

0 comments on commit a071ae7

Please sign in to comment.