fix: remove initGlobalContext writes in tests (#9331)

since we do not close GlobalContext, we do not
need to reinitialize it inside test code
master
Harshavardhana 5 years ago committed by GitHub
parent a9d401ac10
commit d079adc167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      cmd/test-utils_test.go

@ -96,29 +96,12 @@ const testConcurrencyLevel = 10
/// (that are executed by other agents) or when customers pass requests through proxies, which may /// (that are executed by other agents) or when customers pass requests through proxies, which may
/// modify the user-agent. /// modify the user-agent.
/// ///
/// Content-Length:
///
/// This is ignored from signing because generating a pre-signed URL should not provide a content-length
/// constraint, specifically when vending a S3 pre-signed PUT URL. The corollary to this is that when
/// sending regular requests (non-pre-signed), the signature contains a checksum of the body, which
/// implicitly validates the payload length (since changing the number of bytes would change the checksum)
/// and therefore this header is not valuable in the signature.
///
/// Content-Type:
///
/// Signing this header causes quite a number of problems in browser environments, where browsers
/// like to modify and normalize the content-type header in different ways. There is more information
/// on this in https://github.com/aws/aws-sdk-js/issues/244. Avoiding this field simplifies logic
/// and reduces the possibility of future bugs
///
/// Authorization: /// Authorization:
/// ///
/// Is skipped for obvious reasons /// Is skipped for obvious reasons
/// ///
var ignoredHeaders = map[string]bool{ var ignoredHeaders = map[string]bool{
"Authorization": true, "Authorization": true,
"Content-Type": true,
"Content-Length": true,
"User-Agent": true, "User-Agent": true,
} }
@ -481,10 +464,6 @@ func resetGlobalIAMSys() {
// Resets all the globals used modified in tests. // Resets all the globals used modified in tests.
// Resetting ensures that the changes made to globals by one test doesn't affect others. // Resetting ensures that the changes made to globals by one test doesn't affect others.
func resetTestGlobals() { func resetTestGlobals() {
// close any indefinitely running go-routines from previous
// tests.
cancelGlobalContext()
initGlobalContext()
// set globalObjectAPI to `nil`. // set globalObjectAPI to `nil`.
resetGlobalObjectAPI() resetGlobalObjectAPI()
// Reset config path set. // Reset config path set.

Loading…
Cancel
Save