Skip to content

Commit 19da475

Browse files
authored
feat(exp): rename *utils package to *util (#487)
Use a smaller and clearer package name.
1 parent f7ac563 commit 19da475

File tree

13 files changed

+20
-20
lines changed

13 files changed

+20
-20
lines changed

hcloud/action_waiter_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import (
66

77
"github.com/stretchr/testify/assert"
88

9-
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutils"
9+
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutil"
1010
)
1111

1212
func TestWaitFor(t *testing.T) {
1313
RunMockedTestCases(t,
1414
[]MockedTestCase{
1515
{
1616
Name: "succeed",
17-
WantRequests: []mockutils.Request{
17+
WantRequests: []mockutil.Request{
1818
{Method: "GET", Path: "/actions?id=1509772237&page=1&sort=status&sort=id",
1919
Status: 200,
2020
JSONRaw: `{
@@ -52,7 +52,7 @@ func TestWaitFor(t *testing.T) {
5252
},
5353
{
5454
Name: "fail with unknown action",
55-
WantRequests: []mockutils.Request{
55+
WantRequests: []mockutil.Request{
5656
{Method: "GET", Path: "/actions?id=1509772237&page=1&sort=status&sort=id",
5757
Status: 200,
5858
JSONRaw: `{
@@ -82,7 +82,7 @@ func TestWaitFor(t *testing.T) {
8282
},
8383
{
8484
Name: "fail with server error",
85-
WantRequests: []mockutils.Request{
85+
WantRequests: []mockutil.Request{
8686
{Method: "GET", Path: "/actions?id=1509772237&page=1&sort=status&sort=id",
8787
Status: 500,
8888
},
@@ -97,7 +97,7 @@ func TestWaitFor(t *testing.T) {
9797
},
9898
{
9999
Name: "succeed with retry",
100-
WantRequests: []mockutils.Request{
100+
WantRequests: []mockutil.Request{
101101
{Method: "GET", Path: "/actions?id=1509772237&page=1&sort=status&sort=id",
102102
Status: 503,
103103
},
@@ -127,7 +127,7 @@ func TestWaitForFunc(t *testing.T) {
127127
[]MockedTestCase{
128128
{
129129
Name: "succeed",
130-
WantRequests: []mockutils.Request{
130+
WantRequests: []mockutil.Request{
131131
{Method: "GET", Path: "/actions?id=1509772237&id=1509772238&page=1&sort=status&sort=id",
132132
Status: 200,
133133
JSONRaw: `{

hcloud/exp/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Experimental
22

3-
The [`exp`](./) namespace holds experimental features for the `hcloud-go` library. The [`exp/kit`](./kit/) namespace is reserved for features not directly related to the `hcloud-go` library, for example the [`sshutils`](./kit/sshutils) package has functions to generate ssh keys.
3+
The [`exp`](./) namespace holds experimental features for the `hcloud-go` library. The [`exp/kit`](./kit/) namespace is reserved for features not directly related to the `hcloud-go` library, for example the [`sshutil`](./kit/sshutil) package has functions to generate ssh keys.
44

55
> [!CAUTION]
66
> Breaking changes may occur without notice. Do not use in production!

hcloud/exp/actionutils/actions.go renamed to hcloud/exp/actionutil/actions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package actionutils
1+
package actionutil
22

33
import "github.com/hetznercloud/hcloud-go/v2/hcloud"
44

hcloud/exp/actionutils/actions_test.go renamed to hcloud/exp/actionutil/actions_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package actionutils
1+
package actionutil
22

33
import (
44
"testing"

hcloud/exp/kit/envutils/env.go renamed to hcloud/exp/kit/envutil/env.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package envutils
1+
package envutil
22

33
import (
44
"fmt"

hcloud/exp/kit/envutils/env_test.go renamed to hcloud/exp/kit/envutil/env_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package envutils
1+
package envutil
22

33
import (
44
"os"

hcloud/exp/kit/sshutils/ssh_key.go renamed to hcloud/exp/kit/sshutil/ssh_key.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sshutils
1+
package sshutil
22

33
import (
44
"crypto"

hcloud/exp/kit/sshutils/ssh_key_test.go renamed to hcloud/exp/kit/sshutil/ssh_key_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sshutils
1+
package sshutil
22

33
import (
44
"strings"

hcloud/exp/labelutils/selector.go renamed to hcloud/exp/labelutil/selector.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package labelutils
1+
package labelutil
22

33
import (
44
"fmt"

hcloud/exp/labelutils/selector_test.go renamed to hcloud/exp/labelutil/selector_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package labelutils
1+
package labelutil
22

33
import "testing"
44

hcloud/exp/mockutils/mockutils.go renamed to hcloud/exp/mockutil/http.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mockutils
1+
package mockutil
22

33
import (
44
"encoding/json"

hcloud/exp/mockutils/mockutils_test.go renamed to hcloud/exp/mockutil/http_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mockutils
1+
package mockutil
22

33
import (
44
"fmt"

hcloud/mocked_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import (
44
"net/http/httptest"
55
"testing"
66

7-
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutils"
7+
"github.com/hetznercloud/hcloud-go/v2/hcloud/exp/mockutil"
88
)
99

1010
type MockedTestCase struct {
1111
Name string
12-
WantRequests []mockutils.Request
12+
WantRequests []mockutil.Request
1313
Run func(env testEnv)
1414
}
1515

1616
func RunMockedTestCases(t *testing.T, testCases []MockedTestCase) {
1717
for _, testCase := range testCases {
1818
t.Run(testCase.Name, func(t *testing.T) {
19-
testServer := httptest.NewServer(mockutils.Handler(t, testCase.WantRequests))
19+
testServer := httptest.NewServer(mockutil.Handler(t, testCase.WantRequests))
2020

2121
env := newTestEnvWithServer(testServer, nil)
2222
defer env.Teardown()

0 commit comments

Comments
 (0)