Addressing review comments

This commit is contained in:
Denis Makogon
2017-09-12 20:07:40 +03:00
parent 33a8b87dc0
commit 4052a7d428
4 changed files with 15 additions and 32 deletions

View File

@@ -60,6 +60,8 @@ func (m *mock) UpdateApp(ctx context.Context, app *models.App) (*models.App, err
}
func (m *mock) RemoveApp(ctx context.Context, appName string) error {
m.batchDeleteCalls(ctx, appName)
m.batchDeleteRoutes(ctx, appName)
for i, a := range m.Apps {
if a.Name == appName {
m.Apps = append(m.Apps[:i], m.Apps[i+1:]...)
@@ -157,7 +159,7 @@ func (m *mock) GetCalls(ctx context.Context, filter *models.CallFilter) ([]*mode
return m.Calls, nil
}
func (m *mock) BatchDeleteCalls(ctx context.Context, appName string) error {
func (m *mock) batchDeleteCalls(ctx context.Context, appName string) error {
newCalls := []*models.Call{}
for _, c := range m.Calls {
if c.AppName != appName {
@@ -168,7 +170,7 @@ func (m *mock) BatchDeleteCalls(ctx context.Context, appName string) error {
return nil
}
func (m *mock) BatchDeleteRoutes(ctx context.Context, appName string) error {
func (m *mock) batchDeleteRoutes(ctx context.Context, appName string) error {
newRoutes := []*models.Route{}
for _, c := range m.Routes {
if c.AppName != appName {