terminology: rename route -> deployment
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
committed by
Solomon Hykes
parent
e503e12cff
commit
f901918266
@@ -17,38 +17,38 @@ func TestStoreLoad(t *testing.T) {
|
||||
store, err := NewStore(root)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = store.LookupRouteByName(ctx, "notexist")
|
||||
_, err = store.LookupDeploymentByName(ctx, "notexist")
|
||||
require.Error(t, err)
|
||||
require.True(t, errors.Is(err, ErrRouteNotExist))
|
||||
require.True(t, errors.Is(err, ErrDeploymentNotExist))
|
||||
|
||||
st := &RouteState{
|
||||
st := &DeploymentState{
|
||||
Name: "test",
|
||||
}
|
||||
require.NoError(t, store.CreateRoute(ctx, st))
|
||||
require.NoError(t, store.CreateDeployment(ctx, st))
|
||||
|
||||
checkRoutes := func(store *Store) {
|
||||
r, err := store.LookupRouteByID(ctx, st.ID)
|
||||
checkDeployments := func(store *Store) {
|
||||
r, err := store.LookupDeploymentByID(ctx, st.ID)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, r)
|
||||
require.Equal(t, "test", r.Name)
|
||||
|
||||
r, err = store.LookupRouteByName(ctx, "test")
|
||||
r, err = store.LookupDeploymentByName(ctx, "test")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, r)
|
||||
require.Equal(t, "test", r.Name)
|
||||
|
||||
routes, err := store.ListRoutes(ctx)
|
||||
deployments, err := store.ListDeployments(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, routes, 1)
|
||||
require.Equal(t, "test", routes[0].Name)
|
||||
require.Len(t, deployments, 1)
|
||||
require.Equal(t, "test", deployments[0].Name)
|
||||
}
|
||||
|
||||
checkRoutes(store)
|
||||
checkDeployments(store)
|
||||
|
||||
// Reload the routes from disk and check again
|
||||
// Reload the deployments from disk and check again
|
||||
newStore, err := NewStore(root)
|
||||
require.NoError(t, err)
|
||||
checkRoutes(newStore)
|
||||
checkDeployments(newStore)
|
||||
}
|
||||
|
||||
func TestStoreLookupByPath(t *testing.T) {
|
||||
@@ -59,41 +59,41 @@ func TestStoreLookupByPath(t *testing.T) {
|
||||
store, err := NewStore(root)
|
||||
require.NoError(t, err)
|
||||
|
||||
st := &RouteState{
|
||||
st := &DeploymentState{
|
||||
Name: "test",
|
||||
}
|
||||
require.NoError(t, st.AddInput("foo", DirInput("/test/path", []string{})))
|
||||
require.NoError(t, store.CreateRoute(ctx, st))
|
||||
require.NoError(t, store.CreateDeployment(ctx, st))
|
||||
|
||||
// Lookup by path
|
||||
r, err := store.LookupRouteByPath(ctx, "/test/path")
|
||||
r, err := store.LookupDeploymentByPath(ctx, "/test/path")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, r)
|
||||
require.Equal(t, st.ID, r.ID)
|
||||
|
||||
// Add a new path
|
||||
require.NoError(t, st.AddInput("bar", DirInput("/test/anotherpath", []string{})))
|
||||
require.NoError(t, store.UpdateRoute(ctx, st, nil))
|
||||
require.NoError(t, store.UpdateDeployment(ctx, st, nil))
|
||||
|
||||
// Lookup by the previous path
|
||||
r, err = store.LookupRouteByPath(ctx, "/test/path")
|
||||
r, err = store.LookupDeploymentByPath(ctx, "/test/path")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, st.ID, r.ID)
|
||||
|
||||
// Lookup by the new path
|
||||
r, err = store.LookupRouteByPath(ctx, "/test/anotherpath")
|
||||
r, err = store.LookupDeploymentByPath(ctx, "/test/anotherpath")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, st.ID, r.ID)
|
||||
|
||||
// Remove a path
|
||||
require.NoError(t, st.RemoveInputs("foo"))
|
||||
require.NoError(t, store.UpdateRoute(ctx, st, nil))
|
||||
require.NoError(t, store.UpdateDeployment(ctx, st, nil))
|
||||
|
||||
// Lookup by the removed path should fail
|
||||
_, err = store.LookupRouteByPath(ctx, "/test/path")
|
||||
_, err = store.LookupDeploymentByPath(ctx, "/test/path")
|
||||
require.Error(t, err)
|
||||
|
||||
// Lookup by the other path should still work
|
||||
_, err = store.LookupRouteByPath(ctx, "/test/anotherpath")
|
||||
_, err = store.LookupDeploymentByPath(ctx, "/test/anotherpath")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user