mirror of
https://github.com/docker/compose.git
synced 2026-11-17 13:45:39 +00:00
pkg/compose carried its own copy of the event constructors that internal/progress already provides. Use the shared ones and move the generic waiting, healthy, exited and skipped events there too. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
41 lines
2.2 KiB
Go
41 lines
2.2 KiB
Go
/*
|
|
Copyright 2020 Docker Compose CLI authors
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package progress
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
"github.com/docker/compose/v5/pkg/api"
|
|
)
|
|
|
|
func TestEvents(t *testing.T) {
|
|
assert.DeepEqual(t, Creating("web"), api.Resource{ID: "web", Status: api.Working, Text: api.StatusCreating})
|
|
assert.DeepEqual(t, Created("web"), api.Resource{ID: "web", Status: api.Done, Text: api.StatusCreated})
|
|
assert.DeepEqual(t, Removing("web"), api.Resource{ID: "web", Status: api.Working, Text: api.StatusRemoving})
|
|
assert.DeepEqual(t, Removed("web"), api.Resource{ID: "web", Status: api.Done, Text: api.StatusRemoved})
|
|
assert.DeepEqual(t, Stopping("web"), api.Resource{ID: "web", Status: api.Working, Text: api.StatusStopping})
|
|
assert.DeepEqual(t, Stopped("web"), api.Resource{ID: "web", Status: api.Done, Text: api.StatusStopped})
|
|
assert.DeepEqual(t, Waiting("web"), api.Resource{ID: "web", Status: api.Working, Text: api.StatusWaiting})
|
|
assert.DeepEqual(t, Healthy("web"), api.Resource{ID: "web", Status: api.Done, Text: api.StatusHealthy})
|
|
assert.DeepEqual(t, Exited("web"), api.Resource{ID: "web", Status: api.Done, Text: api.StatusExited})
|
|
assert.DeepEqual(t, Skipped("web", "why"), api.Resource{ID: "web", Status: api.Warning, Text: "Skipped: why"})
|
|
assert.DeepEqual(t, Error("web", "boom"), api.Resource{ID: "web", Status: api.Error, Text: api.StatusError, Details: "boom"})
|
|
assert.DeepEqual(t, New("web", api.Warning, "Skipped", "why"), api.Resource{ID: "web", Status: api.Warning, Text: "Skipped", Details: "why"})
|
|
assert.DeepEqual(t, New("web", api.Warning, "Skipped"), api.Resource{ID: "web", Status: api.Warning, Text: "Skipped"})
|
|
}
|