-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update_security_compliance
- Loading branch information
Showing
156 changed files
with
5,426 additions
and
3,549 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ RUN go mod download | |
|
||
RUN if [ "$INSTALL_TOOLS" == "yes" ] ; then \ | ||
go install github.com/swaggo/swag/cmd/[email protected] && \ | ||
go install gotest.tools/[email protected] && \ | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ | ||
| sh -s -- -b $(go env GOPATH)/bin v1.50.0 ; \ | ||
fi | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
v3.1.27 | ||
v3.5.7 |
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
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
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
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,49 @@ | ||
package database | ||
|
||
import ( | ||
"app/base/rbac" | ||
"app/base/utils" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
var ( | ||
// counts of systems from system_platform JOIN inventory.hosts | ||
nGroup1 int64 = 6 | ||
nGroup2 int64 = 2 | ||
nUngrouped int64 = 6 | ||
nAll int64 = 16 | ||
) | ||
|
||
// nolint: lll | ||
var testCases = []map[int64]map[string]string{ | ||
{nGroup1: {rbac.KeyGrouped: `{"[{\"id\":\"inventory-group-1\"}]"}`}}, | ||
{nGroup2: {rbac.KeyGrouped: `{"[{\"id\":\"inventory-group-2\"}]"}`}}, | ||
{nGroup1 + nGroup2: {rbac.KeyGrouped: `{"[{\"id\":\"inventory-group-1\"}]","[{\"id\":\"inventory-group-2\"}]"}`}}, | ||
{nGroup1 + nUngrouped: { | ||
rbac.KeyGrouped: `{"[{\"id\":\"inventory-group-1\"}]"}`, | ||
rbac.KeyUngrouped: "[]", | ||
}}, | ||
{nUngrouped: { | ||
rbac.KeyGrouped: `{"[{\"id\":\"non-existing-group\"}]"}`, | ||
rbac.KeyUngrouped: "[]", | ||
}}, | ||
{0: {rbac.KeyGrouped: `{"[{\"id\":\"non-existing-group\"}]"}`}}, | ||
{nUngrouped: {rbac.KeyUngrouped: "[]"}}, | ||
{nAll: {}}, | ||
{nAll: nil}, | ||
} | ||
|
||
func TestInventoryHostsJoin(t *testing.T) { | ||
utils.SkipWithoutDB(t) | ||
Configure() | ||
|
||
for _, tc := range testCases { | ||
for expectedCount, groups := range tc { | ||
var count int64 | ||
InventoryHostsJoin(Db.Table("system_platform sp"), groups).Count(&count) | ||
assert.Equal(t, expectedCount, count) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.