Skip to content

Commit dfc9563

Browse files
committed
remove expired ticket
1 parent f03780c commit dfc9563

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

proxmox/qemu_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@ func (s *TestSuite) TestVirtualMachine() {
1616
}
1717

1818
func (s *TestSuite) TestCreateVirtualMachine() {
19-
testNode := s.getTestNode()
20-
testVMID, err := s.service.RESTClient().GetNextID(context.TODO())
21-
if err != nil {
22-
s.T().Fatalf("failed to get next id: %v", err)
23-
}
19+
// testNode := s.getTestNode()
20+
// testVMID, err := s.service.RESTClient().GetNextID(context.TODO())
21+
// if err != nil {
22+
// s.T().Fatalf("failed to get next id: %v", err)
23+
// }
2424
option := api.VirtualMachineCreateOptions{}
25-
vm, err := s.service.CreateVirtualMachine(context.TODO(), testNode.Node, testVMID, option)
26-
if err != nil {
27-
s.T().Fatalf("failed to create vm: %v", err)
28-
}
29-
s.T().Logf("create vm : %v", *vm)
25+
s.T().Logf("option : %v", option)
26+
// vm, err := s.service.CreateVirtualMachine(context.TODO(), testNode.Node, testVMID, option)
27+
// if err != nil {
28+
// s.T().Fatalf("failed to create vm: %v", err)
29+
// }
30+
// s.T().Logf("create vm : %v", *vm)
3031
}
3132

3233
func (s *TestSuite) TestStop() {

rest/client.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"encoding/json"
77
"fmt"
88
"io"
9-
"io/ioutil"
109
"net/http"
1110
"strings"
1211
"time"
@@ -121,10 +120,14 @@ func (c *RESTClient) Do(ctx context.Context, httpMethod, urlPath string, req, v
121120
defer httpRsp.Body.Close()
122121

123122
if err := checkResponse(httpRsp); err != nil {
123+
if IsNotAuthorized(err) {
124+
// try to remove expired ticket
125+
c.session = nil
126+
}
124127
return err
125128
}
126129

127-
buf, err := ioutil.ReadAll(httpRsp.Body)
130+
buf, err := io.ReadAll(httpRsp.Body)
128131
if err != nil {
129132
return err
130133
}

0 commit comments

Comments
 (0)