Issue #2198 - Print empty string instead of Unknown in 'argocd app sync' output (#2223)

This commit is contained in:
Alexander Matyushentsev 2019-08-26 16:42:48 -07:00 committed by GitHub
parent 476682ba8c
commit 9d4a32e94f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -1375,7 +1375,7 @@ func getResourceStates(app *argoappv1.Application, selectedResources []argoappv1
health := string(res.Status)
key := kube.NewResourceKey(res.Group, res.Kind, res.Namespace, res.Name)
if resource, ok := resourceByKey[key]; ok && res.HookType == "" {
health = argoappv1.HealthStatusUnknown
health = ""
if resource.Health != nil {
health = resource.Health.Status
}
@ -1396,7 +1396,7 @@ func getResourceStates(app *argoappv1.Application, selectedResources []argoappv1
// print rest of resources which were not part of most recent operation
for _, resKey := range resKeys {
res := resourceByKey[resKey]
health := argoappv1.HealthStatusUnknown
health := ""
if res.Health != nil {
health = res.Health.Status
}

View file

@ -409,7 +409,7 @@ func TestDuplicatedResources(t *testing.T) {
}
func TestConfigMap(t *testing.T) {
testEdgeCasesApplicationResources(t, "config-map", HealthStatusHealthy)
testEdgeCasesApplicationResources(t, "config-map", HealthStatusHealthy, "my-map Synced configmap/my-map created")
}
func TestFailedConversion(t *testing.T) {
@ -421,15 +421,19 @@ func TestFailedConversion(t *testing.T) {
testEdgeCasesApplicationResources(t, "failed-conversion", HealthStatusProgressing)
}
func testEdgeCasesApplicationResources(t *testing.T, appPath string, statusCode HealthStatusCode) {
Given(t).
func testEdgeCasesApplicationResources(t *testing.T, appPath string, statusCode HealthStatusCode, message ...string) {
expect := Given(t).
Path(appPath).
When().
Create().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
for i := range message {
expect = expect.Expect(Success(message[i]))
}
expect.
Expect(HealthIs(statusCode)).
And(func(app *Application) {
diffOutput, err := fixture.RunCli("app", "diff", app.Name, "--local", path.Join("testdata", appPath))