-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connectors status: --quiet flag & return error if failing tasks
- Loading branch information
1 parent
00db60c
commit 1e69f0f
Showing
3 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package connectors | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/90poe/connectctl/pkg/client/connect" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestCountFailing(t *testing.T) { | ||
statusList := []*connect.ConnectorStatus{ | ||
{ | ||
Connector: connect.ConnectorState{ | ||
State: "RUNNING", | ||
}, | ||
Tasks: []connect.TaskState{ | ||
{ | ||
State: "RUNNING", | ||
}, | ||
{ | ||
State: "FAILED", | ||
}, | ||
}, | ||
}, | ||
{ | ||
Connector: connect.ConnectorState{ | ||
State: "FAILED", | ||
}, | ||
Tasks: []connect.TaskState{ | ||
{ | ||
State: "FAILED", | ||
}, | ||
{ | ||
State: "FAILED", | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
connectorsFailing, tasksFailing := countFailing(statusList) | ||
|
||
require.Equal(t, 1, connectorsFailing) | ||
require.Equal(t, 3, tasksFailing) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters