Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Commit d1ebd1b

Browse files
authored
Eradicating server service from fleetdb repo (#18)
1 parent cce197c commit d1ebd1b

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ integration-test: test-database
1919
## run lint and unit tests
2020
unit-test: | lint
2121
@echo Running unit tests...
22-
@SERVERSERVICE_CRDB_URI="${TEST_DB}" go test -cover -short -tags testtools ./...
22+
@FLEETDB_CRDB_URI="${TEST_DB}" go test -cover -short -tags testtools ./...
2323

2424
## check test coverage
2525
coverage: | test-database

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var (
2525

2626
// rootCmd represents the base command when called without any subcommands
2727
var rootCmd = &cobra.Command{
28-
Use: "serverservice",
28+
Use: "fleetdb",
2929
Short: "Server Service for Hollow ecosystem",
3030
}
3131

cmd/serve.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ func init() {
6969
rootCmd.PersistentFlags().String("nats-stream-name", appName, "prefix for NATS subjects")
7070
viperx.MustBindFlag(viper.GetViper(), "nats.stream.name", rootCmd.PersistentFlags().Lookup("nats-stream-name"))
7171

72-
rootCmd.PersistentFlags().String("nats-stream-prefix", "com.hollow.sh.serverservice.events", "NATS stream prefix")
72+
rootCmd.PersistentFlags().String("nats-stream-prefix", "com.hollow.sh.fleetdb.events", "NATS stream prefix")
7373
viperx.MustBindFlag(viper.GetViper(), "nats.stream.prefix", rootCmd.PersistentFlags().Lookup("nats-stream-prefix"))
7474

75-
rootCmd.PersistentFlags().StringSlice("nats-stream-subjects", []string{"com.hollow.sh.serverservice.events.>"}, "NATS stream subject(s)")
75+
rootCmd.PersistentFlags().StringSlice("nats-stream-subjects", []string{"com.hollow.sh.fleetdb.events.>"}, "NATS stream subject(s)")
7676
viperx.MustBindFlag(viper.GetViper(), "nats.stream.subjects", rootCmd.PersistentFlags().Lookup("nats-stream-subjects"))
7777

7878
rootCmd.PersistentFlags().String("nats-stream-urn-ns", "hollow", "NATS stream URN namespace value")

pkg/api/v1/router_server_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ func TestIntegrationServerUpdate(t *testing.T) {
712712
})
713713
}
714714

715-
func TestIntegrationServerServiceCreateVersionedAttributes(t *testing.T) {
715+
func TestIntegrationFleetdbCreateVersionedAttributes(t *testing.T) {
716716
s := serverTest(t)
717717

718718
realClientTests(t, func(ctx context.Context, authToken string, respCode int, expectError bool) error {
@@ -729,7 +729,7 @@ func TestIntegrationServerServiceCreateVersionedAttributes(t *testing.T) {
729729
})
730730
}
731731

732-
func TestIntegrationServerServiceCreateVersionedAttributesIncrementCounter(t *testing.T) {
732+
func TestIntegrationFleetdbCreateVersionedAttributesIncrementCounter(t *testing.T) {
733733
s := serverTest(t)
734734
s.Client.SetToken(validToken(adminScopes))
735735

@@ -769,7 +769,7 @@ func TestIntegrationServerServiceCreateVersionedAttributesIncrementCounter(t *te
769769
assert.Equal(t, 1, r[1].Tally)
770770
}
771771

772-
func TestIntegrationServerServiceListVersionedAttributes(t *testing.T) {
772+
func TestIntegrationFleetdbListVersionedAttributes(t *testing.T) {
773773
s := serverTest(t)
774774

775775
realClientTests(t, func(ctx context.Context, authToken string, respCode int, expectError bool) error {

pkg/api/v1/server_service_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
fleetdbapi "github.com/metal-toolbox/fleetdb/pkg/api/v1"
1313
)
1414

15-
func TestServerServiceCreate(t *testing.T) {
15+
func TestFleetdbCreate(t *testing.T) {
1616
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
1717
srv := fleetdbapi.Server{UUID: uuid.New(), FacilityCode: "Test1"}
1818
jsonResponse := json.RawMessage([]byte(`{"message": "resource created", "slug":"00000000-0000-0000-0000-000000001234"}`))
@@ -27,7 +27,7 @@ func TestServerServiceCreate(t *testing.T) {
2727
})
2828
}
2929

30-
func TestServerServiceDelete(t *testing.T) {
30+
func TestFleetdbDelete(t *testing.T) {
3131
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
3232
jsonResponse := json.RawMessage([]byte(`{"message": "resource deleted"}`))
3333
c := mockClient(string(jsonResponse), respCode)
@@ -36,7 +36,7 @@ func TestServerServiceDelete(t *testing.T) {
3636
return err
3737
})
3838
}
39-
func TestServerServiceGet(t *testing.T) {
39+
func TestFleetdbGet(t *testing.T) {
4040
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
4141
srv := fleetdbapi.Server{UUID: uuid.New(), FacilityCode: "Test1"}
4242
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Record: srv})
@@ -53,7 +53,7 @@ func TestServerServiceGet(t *testing.T) {
5353
})
5454
}
5555

56-
func TestServerServiceList(t *testing.T) {
56+
func TestFleetdbList(t *testing.T) {
5757
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
5858
srv := []fleetdbapi.Server{{UUID: uuid.New(), FacilityCode: "Test1"}}
5959
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Records: srv})
@@ -69,7 +69,7 @@ func TestServerServiceList(t *testing.T) {
6969
})
7070
}
7171

72-
func TestServerServiceUpdate(t *testing.T) {
72+
func TestFleetdbUpdate(t *testing.T) {
7373
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
7474
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Message: "resource updated"})
7575
require.Nil(t, err)
@@ -81,7 +81,7 @@ func TestServerServiceUpdate(t *testing.T) {
8181
})
8282
}
8383

84-
func TestServerServiceCreateAttributes(t *testing.T) {
84+
func TestFleetdbCreateAttributes(t *testing.T) {
8585
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
8686
attr := fleetdbapi.Attributes{Namespace: "unit-test", Data: json.RawMessage([]byte(`{"test":"unit"}`))}
8787
jsonResponse := json.RawMessage([]byte(`{"message": "resource created"}`))
@@ -92,7 +92,7 @@ func TestServerServiceCreateAttributes(t *testing.T) {
9292
return err
9393
})
9494
}
95-
func TestServerServiceGetAttributes(t *testing.T) {
95+
func TestFleetdbGetAttributes(t *testing.T) {
9696
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
9797
attr := &fleetdbapi.Attributes{Namespace: "unit-test", Data: json.RawMessage([]byte(`{"test":"unit"}`))}
9898
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Record: attr})
@@ -108,7 +108,7 @@ func TestServerServiceGetAttributes(t *testing.T) {
108108
})
109109
}
110110

111-
func TestServerServiceDeleteAttributes(t *testing.T) {
111+
func TestFleetdbDeleteAttributes(t *testing.T) {
112112
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
113113
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Message: "resource deleted"})
114114
require.Nil(t, err)
@@ -120,7 +120,7 @@ func TestServerServiceDeleteAttributes(t *testing.T) {
120120
})
121121
}
122122

123-
func TestServerServiceListAttributes(t *testing.T) {
123+
func TestFleetdbListAttributes(t *testing.T) {
124124
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
125125
attrs := []fleetdbapi.Attributes{{Namespace: "unit-test", Data: json.RawMessage([]byte(`{"test":"unit"}`))}}
126126
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Records: attrs})
@@ -136,7 +136,7 @@ func TestServerServiceListAttributes(t *testing.T) {
136136
})
137137
}
138138

139-
func TestServerServiceUpdateAttributes(t *testing.T) {
139+
func TestFleetdbUpdateAttributes(t *testing.T) {
140140
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
141141
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Message: "resource updated"})
142142
require.Nil(t, err)
@@ -148,7 +148,7 @@ func TestServerServiceUpdateAttributes(t *testing.T) {
148148
})
149149
}
150150

151-
func TestServerServiceComponentsGet(t *testing.T) {
151+
func TestFleetdbComponentsGet(t *testing.T) {
152152
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
153153
sc := []fleetdbapi.ServerComponent{{Name: "unit-test", Serial: "1234"}}
154154
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Records: sc})
@@ -164,7 +164,7 @@ func TestServerServiceComponentsGet(t *testing.T) {
164164
})
165165
}
166166

167-
func TestServerServiceComponentsList(t *testing.T) {
167+
func TestFleetdbComponentsList(t *testing.T) {
168168
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
169169
sc := []fleetdbapi.ServerComponent{{Name: "unit-test", Serial: "1234"}}
170170
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Records: sc})
@@ -180,7 +180,7 @@ func TestServerServiceComponentsList(t *testing.T) {
180180
})
181181
}
182182

183-
func TestServerServiceComponentsCreate(t *testing.T) {
183+
func TestFleetdbComponentsCreate(t *testing.T) {
184184
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
185185
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Message: "resource created"})
186186
require.Nil(t, err)
@@ -195,7 +195,7 @@ func TestServerServiceComponentsCreate(t *testing.T) {
195195
})
196196
}
197197

198-
func TestServerServiceComponentsUpdate(t *testing.T) {
198+
func TestFleetdbComponentsUpdate(t *testing.T) {
199199
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
200200
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Message: "resource updated"})
201201
require.Nil(t, err)
@@ -210,7 +210,7 @@ func TestServerServiceComponentsUpdate(t *testing.T) {
210210
})
211211
}
212212

213-
func TestServerServiceVersionedAttributeCreate(t *testing.T) {
213+
func TestFleetdbVersionedAttributeCreate(t *testing.T) {
214214
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
215215
va := fleetdbapi.VersionedAttributes{Namespace: "unit-test", Data: json.RawMessage([]byte(`{"test":"unit"}`))}
216216
jsonResponse := json.RawMessage([]byte(`{"message": "resource created", "slug":"the-namespace"}`))
@@ -225,7 +225,7 @@ func TestServerServiceVersionedAttributeCreate(t *testing.T) {
225225
})
226226
}
227227

228-
func TestServerServiceGetVersionedAttributess(t *testing.T) {
228+
func TestFleetdbGetVersionedAttributess(t *testing.T) {
229229
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
230230
va := []fleetdbapi.VersionedAttributes{{Namespace: "test", Data: json.RawMessage([]byte(`{}`))}}
231231
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Records: va})
@@ -241,7 +241,7 @@ func TestServerServiceGetVersionedAttributess(t *testing.T) {
241241
})
242242
}
243243

244-
func TestServerServiceListVersionedAttributess(t *testing.T) {
244+
func TestFleetdbListVersionedAttributess(t *testing.T) {
245245
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
246246
va := []fleetdbapi.VersionedAttributes{{Namespace: "test", Data: json.RawMessage([]byte(`{}`))}}
247247
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Records: va})
@@ -257,7 +257,7 @@ func TestServerServiceListVersionedAttributess(t *testing.T) {
257257
})
258258
}
259259

260-
func TestServerServiceCreateServerComponentFirmware(t *testing.T) {
260+
func TestFleetdbCreateServerComponentFirmware(t *testing.T) {
261261
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
262262
firmware := fleetdbapi.ComponentFirmwareVersion{
263263
UUID: uuid.New(),
@@ -277,7 +277,7 @@ func TestServerServiceCreateServerComponentFirmware(t *testing.T) {
277277
})
278278
}
279279

280-
func TestServerServiceServerComponentFirmwareDelete(t *testing.T) {
280+
func TestFleetdbServerComponentFirmwareDelete(t *testing.T) {
281281
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
282282
jsonResponse := json.RawMessage([]byte(`{"message": "resource deleted"}`))
283283
c := mockClient(string(jsonResponse), respCode)
@@ -286,7 +286,7 @@ func TestServerServiceServerComponentFirmwareDelete(t *testing.T) {
286286
return err
287287
})
288288
}
289-
func TestServerServiceServerComponentFirmwareGet(t *testing.T) {
289+
func TestFleetdbServerComponentFirmwareGet(t *testing.T) {
290290
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
291291
firmware := fleetdbapi.ComponentFirmwareVersion{
292292
UUID: uuid.New(),
@@ -310,7 +310,7 @@ func TestServerServiceServerComponentFirmwareGet(t *testing.T) {
310310
})
311311
}
312312

313-
func TestServerServiceServerComponentFirmwareList(t *testing.T) {
313+
func TestFleetdbServerComponentFirmwareList(t *testing.T) {
314314
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
315315
firmware := []fleetdbapi.ComponentFirmwareVersion{{
316316
UUID: uuid.New(),
@@ -331,7 +331,7 @@ func TestServerServiceServerComponentFirmwareList(t *testing.T) {
331331
})
332332
}
333333

334-
func TestServerServiceServerComponentFirmwareUpdate(t *testing.T) {
334+
func TestFleetdbServerComponentFirmwareUpdate(t *testing.T) {
335335
mockClientTests(t, func(ctx context.Context, respCode int, expectError bool) error {
336336
jsonResponse, err := json.Marshal(fleetdbapi.ServerResponse{Message: "resource updated"})
337337
require.Nil(t, err)

0 commit comments

Comments
 (0)