Skip to content

Commit

Permalink
Add GetCDCAPI unit test for the server (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: SimFG <bang.fu@zilliz.com>
  • Loading branch information
SimFG authored Nov 9, 2023
1 parent f3bfc76 commit 003bc1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/cdc_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ func (b *BaseCDC) List(request *request.ListRequest) (*request.ListResponse, err
return nil, nil
}

func GetCDCApi(config *CDCServerConfig) CDCService {
func GetCDCAPI(config *CDCServerConfig) CDCService {
return NewMetaCDC(config)
}
6 changes: 6 additions & 0 deletions server/cdc_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ func TestDefaultCDCServer(t *testing.T) {
assert.NoError(t, err)
}
}

func TestGetCDCAPI(t *testing.T) {
assert.Panics(t, func() {
GetCDCAPI(&CDCServerConfig{})
})
}
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (c *CDCServer) Run(config *CDCServerConfig) {
metrics.RegisterMetric()

c.serverConfig = config
c.api = GetCDCApi(c.serverConfig)
c.api = GetCDCAPI(c.serverConfig)
c.api.ReloadTask()
cdcHandler := c.getCDCHandler()
http.Handle("/cdc", cdcHandler)
Expand Down

0 comments on commit 003bc1f

Please sign in to comment.