Repository: gophercloud/gophercloud

Issue:
TestEC2AuthMethod test fails due to keystone changes
### What happened?

The functional-basic job started [failing on all branches](https://github.com/gophercloud/gophercloud/actions/runs/19317414717/job/55251562655#step:7:1009):
```
=== FAIL: internal/acceptance/openstack TestEC2AuthMethod (0.49s)
    tools.go:84: {
          "id": "gAAAAABpFTYcNmxkUEsJskvwQv031WXBbmotymVfWEf3EDInbW2cJxsTF4MIrAGDL5p0XjrMDnj_VQN701ZD5vl_dsI-KqZHzKhTVNP6hxfYZXKkSK_-e-h6fLb6_L0zxKXtxK9xBSz4hzKC2KK7UNjprh7vkJothZK2Z4NlbGRp42nbRKjFiSA",
          "expires_at": "2025-11-13T02:36:28Z"
        }
    tools.go:84: {
          "domain": {
            "id": "default",
            "name": "Default"
          },
          "id": "f3b5dcef81a444519e6796fac90604a8",
          "name": "admin"
        }
    tools.go:84: {
          "domain": {
            "id": "default",
            "name": "Default"
          },
          "id": "c6db0f8986c4499a98736b4f12c46377",
          "name": "admin"
        }
    tools.go:84: {
          "id": "3d3367228f9c7665266604462ec60029bcd83ad89614021a80b2eb879c572510",
          "blob": "{\"access\":\"181920\",\"secret\":\"secretKey\"}",
          "user_id": "f3b5dcef81a444519e6796fac90604a8",
          "type": "ec2",
          "project_id": "c6db0f8986c4499a98736b4f12c46377",
          "links": {
            "self": "http://10.1.0.215/identity/v3/credentials/3d3367228f9c7665266604462ec60029bcd83ad89614021a80b2eb879c572510"
          }
        }
    client_test.go:106: Failure in client_test.go, line 106: unexpected error "Expected HTTP response code [200] when accessing [POST http://10.1.0.215/identity/v3/ec2tokens], but got 401 instead: {\"error\":{\"code\":401,\"message\":\"The request you have made requires authentication.\",\"title\":\"Unauthorized\"}}"
```

This is caused by a [recent change in keystone](https://review.opendev.org/q/Ic84b84247e05f29874e2c5636a033aaedd4de83c) that now requires authentication.

### Version

v2 (current)

Discussion:

Solution patch:
diff --git a/openstack/identity/v3/ec2tokens/requests.go b/openstack/identity/v3/ec2tokens/requests.go
index 5b1f3d688..1d4cb5492 100644
--- a/openstack/identity/v3/ec2tokens/requests.go
+++ b/openstack/identity/v3/ec2tokens/requests.go
@@ -300,8 +300,7 @@ func Create(ctx context.Context, c *gophercloud.ServiceClient, opts tokens.AuthO
 	deleteBodyElements(b, "token")
 
 	resp, err := c.Post(ctx, ec2tokensURL(c), b, &r.Body, &gophercloud.RequestOpts{
-		MoreHeaders: map[string]string{"X-Auth-Token": ""},
-		OkCodes:     []int{200},
+		OkCodes: []int{200},
 	})
 	_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
 	return
@@ -320,8 +319,7 @@ func ValidateS3Token(ctx context.Context, c *gophercloud.ServiceClient, opts tok
 	deleteBodyElements(b, "body_hash", "headers", "host", "params", "path", "verb")
 
 	resp, err := c.Post(ctx, s3tokensURL(c), b, &r.Body, &gophercloud.RequestOpts{
-		MoreHeaders: map[string]string{"X-Auth-Token": ""},
-		OkCodes:     []int{200},
+		OkCodes: []int{200},
 	})
 	_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
 	return



Test patch:
diff --git a/internal/acceptance/openstack/client_test.go b/internal/acceptance/openstack/client_test.go
index ccef68855..3a732d42b 100644
--- a/internal/acceptance/openstack/client_test.go
+++ b/internal/acceptance/openstack/client_test.go
@@ -94,7 +94,8 @@ func TestEC2AuthMethod(t *testing.T) {
 	defer credentials.Delete(context.TODO(), client, credential.ID)
 	tools.PrintResource(t, credential)
 
-	newClient, err := clients.NewIdentityV3UnauthenticatedClient()
+	// Create a new provider client for EC2 authentication using the existing token
+	newClient, err := clients.NewIdentityV3Client()
 	th.AssertNoErr(t, err)
 
 	ec2AuthOptions := &ec2tokens.AuthOptions{