Browse Source

Look for api microversion header in "Vary" header data

Apache configuration adds "Accept-Encoding" to the "Vary" header
in its responses, this causes to failures in some tests which check
the "Vary" header content of the response.
In order to avoid this issue we should only check that api microversion
header axists in "Vary" header data.

Change-Id: I1490bf8f424181233aa3ea04a8410052b385699c
Related-bug: #1833766
tags/0.3.0^0
lkuchlan 2 months ago
parent
commit
0ac95412b1
1 changed files with 10 additions and 5 deletions
  1. 10
    5
      manila_tempest_tests/tests/api/test_microversions.py

+ 10
- 5
manila_tempest_tests/tests/api/test_microversions.py View File

@@ -68,7 +68,8 @@ class MicroversionsTest(base.BaseSharesTest):
68 68
         self.assertEqual({'v1.0'}, set(ids))
69 69
 
70 70
         self.assertEqual('1.0', resp.get(API_MICROVERSIONS_HEADER_LOWER))
71
-        self.assertEqual(API_MICROVERSIONS_HEADER, resp.get('vary'))
71
+        self.assertIn(API_MICROVERSIONS_HEADER,
72
+                      resp.get('vary', '').split(','))
72 73
         self.assertEqual('', version_list[0].get('min_version'))
73 74
         self.assertEqual('', version_list[0].get('version'))
74 75
 
@@ -85,7 +86,8 @@ class MicroversionsTest(base.BaseSharesTest):
85 86
         self.assertEqual({'v1.0'}, set(ids))
86 87
 
87 88
         self.assertEqual('1.0', resp.get(API_MICROVERSIONS_HEADER_LOWER))
88
-        self.assertEqual(API_MICROVERSIONS_HEADER, resp.get('vary'))
89
+        self.assertIn(API_MICROVERSIONS_HEADER,
90
+                      resp.get('vary', '').split(','))
89 91
         self.assertEqual('', version_list[0].get('min_version'))
90 92
         self.assertEqual('', version_list[0].get('version'))
91 93
 
@@ -103,7 +105,8 @@ class MicroversionsTest(base.BaseSharesTest):
103 105
 
104 106
         self.assertEqual(_MIN_API_VERSION,
105 107
                          resp.get(API_MICROVERSIONS_HEADER_LOWER))
106
-        self.assertEqual(API_MICROVERSIONS_HEADER, resp.get('vary'))
108
+        self.assertIn(API_MICROVERSIONS_HEADER,
109
+                      resp.get('vary', '').split(','))
107 110
         self.assertEqual(_MIN_API_VERSION, version_list[0].get('min_version'))
108 111
         self.assertNotIn(version_list[0].get('version'), [None, ''])
109 112
 
@@ -121,7 +124,8 @@ class MicroversionsTest(base.BaseSharesTest):
121 124
 
122 125
         self.assertEqual(_MIN_API_VERSION,
123 126
                          resp.get(API_MICROVERSIONS_HEADER_LOWER))
124
-        self.assertEqual(API_MICROVERSIONS_HEADER, resp.get('vary'))
127
+        self.assertIn(API_MICROVERSIONS_HEADER,
128
+                      resp.get('vary', '').split(','))
125 129
         self.assertEqual(_MIN_API_VERSION, version_list[0].get('min_version'))
126 130
         self.assertNotIn(version_list[0].get('version'), [None, ''])
127 131
 
@@ -139,7 +143,8 @@ class MicroversionsTest(base.BaseSharesTest):
139 143
 
140 144
         self.assertEqual(_MAX_API_VERSION,
141 145
                          resp.get(API_MICROVERSIONS_HEADER_LOWER))
142
-        self.assertEqual(API_MICROVERSIONS_HEADER, resp.get('vary'))
146
+        self.assertIn(API_MICROVERSIONS_HEADER,
147
+                      resp.get('vary', '').split(','))
143 148
         self.assertEqual(_MIN_API_VERSION, version_list[0].get('min_version'))
144 149
         self.assertNotIn(version_list[0].get('version'), [None, ''])
145 150
 

Loading…
Cancel
Save