aws-efs-utils/0003-pytest-adjust-tests-to-new-state_file_dir_mode-confi.patch
Robert Schweikert 0fb51ba2d0 Accepting request 690895 from home:glaubitz:branches:Cloud:Tools
- Include hardening and robustness fixes from security audit (bsc#1125133)
  + 0001-subprocess-usage-explicitly-pass-close_fds-True.patch
  + 0002-state_file_dir-choose-safe-default-mode-make-mode-co.patch
  + 0003-pytest-adjust-tests-to-new-state_file_dir_mode-confi.patch
  + 0004-choose_tls_port-reuse-socket-and-explicitly-close-it.patch
  + 0005-watchdog-be-robust-against-unrelated-localhost-based.patch

OBS-URL: https://build.opensuse.org/request/show/690895
OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/aws-efs-utils?expand=0&rev=5
2019-04-03 15:51:34 +00:00

35 lines
1.3 KiB
Diff

From ba525f6b6a41ff9df720e073df9e5bed4c59c360 Mon Sep 17 00:00:00 2001
From: Matthias Gerstner <matthias.gerstner@suse.de>
Date: Fri, 22 Feb 2019 12:46:49 +0100
Subject: [PATCH 3/6] pytest: adjust tests to new state_file_dir_mode config
option
This adds a side_effect to test_bootstrap_tls to cover the new
stat_file_dir_mode config option.
---
test/mount_efs_test/test_bootstrap_tls.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/test/mount_efs_test/test_bootstrap_tls.py b/test/mount_efs_test/test_bootstrap_tls.py
index af1df21..39d5d70 100644
--- a/test/mount_efs_test/test_bootstrap_tls.py
+++ b/test/mount_efs_test/test_bootstrap_tls.py
@@ -66,6 +66,14 @@ def test_bootstrap_tls_state_file_nonexistent_dir(mocker, tmpdir):
mocker.patch('os.kill')
state_file_dir = str(tmpdir.join(tempfile.mktemp()))
+ def config_get_side_effect(section, field):
+ if section == mount_efs.CONFIG_SECTION and field == 'state_file_dir_mode':
+ return '0755'
+ else:
+ raise ValueError('Unexpected arguments')
+
+ MOCK_CONFIG.get.side_effect = config_get_side_effect
+
assert not os.path.exists(state_file_dir)
with mount_efs.bootstrap_tls(MOCK_CONFIG, INIT_SYSTEM, DNS_NAME, FS_ID, MOUNT_POINT, {}, state_file_dir):
--
2.21.0