Skip to content

Commit 51c2dc5

Browse files
authored
Merge pull request #908 from watermint/feature/test_coverage
Feature/test coverage
2 parents f75dd59 + 56ebe48 commit 51c2dc5

File tree

107 files changed

+24047
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+24047
-73
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Test
22

33
on:
44
push:
5-
branches: [ "main", "current" ]
5+
branches: [ "main", "current", "feature/*" ]
66
pull_request:
7-
branches: [ "current" ]
7+
branches: [ "current", "feature/*" ]
88

99
jobs:
1010
test:
@@ -35,4 +35,4 @@ jobs:
3535
- name: upload coverage
3636
uses: codecov/codecov-action@v3
3737
env:
38-
CODECOV_TOKEN: '${{ secrets.CODECOV_TOKEN }}'
38+
CODECOV_TOKEN: '${{ secrets.CODECOV_TOKEN }}'

catalogue/recipe.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package namespace
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func TestMemberNamespaceSummary_Fields(t *testing.T) {
8+
// Test that the struct can be created and fields set
9+
summary := MemberNamespaceSummary{
10+
Email: "test@example.com",
11+
TotalNamespaces: 10,
12+
MountedNamespaces: 8,
13+
OwnerNamespaces: 5,
14+
TeamFolders: 2,
15+
InsideTeamFolders: 3,
16+
ExternalFolders: 1,
17+
AppFolders: 4,
18+
}
19+
20+
if summary.Email != "test@example.com" {
21+
t.Errorf("Expected email 'test@example.com', got %s", summary.Email)
22+
}
23+
if summary.TotalNamespaces != 10 {
24+
t.Errorf("Expected 10 total namespaces, got %d", summary.TotalNamespaces)
25+
}
26+
if summary.MountedNamespaces != 8 {
27+
t.Errorf("Expected 8 mounted namespaces, got %d", summary.MountedNamespaces)
28+
}
29+
if summary.OwnerNamespaces != 5 {
30+
t.Errorf("Expected 5 owner namespaces, got %d", summary.OwnerNamespaces)
31+
}
32+
if summary.TeamFolders != 2 {
33+
t.Errorf("Expected 2 team folders, got %d", summary.TeamFolders)
34+
}
35+
if summary.InsideTeamFolders != 3 {
36+
t.Errorf("Expected 3 inside team folders, got %d", summary.InsideTeamFolders)
37+
}
38+
if summary.ExternalFolders != 1 {
39+
t.Errorf("Expected 1 external folder, got %d", summary.ExternalFolders)
40+
}
41+
if summary.AppFolders != 4 {
42+
t.Errorf("Expected 4 app folders, got %d", summary.AppFolders)
43+
}
44+
}
45+
46+
func TestTeamNamespaceSummary_Fields(t *testing.T) {
47+
summary := TeamNamespaceSummary{
48+
NamespaceType: "shared_folder",
49+
NamespaceCount: 42,
50+
}
51+
52+
if summary.NamespaceType != "shared_folder" {
53+
t.Errorf("Expected namespace type 'shared_folder', got %s", summary.NamespaceType)
54+
}
55+
if summary.NamespaceCount != 42 {
56+
t.Errorf("Expected 42 namespaces, got %d", summary.NamespaceCount)
57+
}
58+
}
59+
60+
func TestTeamFolderSummary_Fields(t *testing.T) {
61+
summary := TeamFolderSummary{
62+
Name: "Engineering Team Folder",
63+
NumNamespacesInside: 15,
64+
}
65+
66+
if summary.Name != "Engineering Team Folder" {
67+
t.Errorf("Expected name 'Engineering Team Folder', got %s", summary.Name)
68+
}
69+
if summary.NumNamespacesInside != 15 {
70+
t.Errorf("Expected 15 namespaces inside, got %d", summary.NumNamespacesInside)
71+
}
72+
}
73+
74+
func TestFolderWithoutParent_Type(t *testing.T) {
75+
// Test that FolderWithoutParent is an alias for mo_sharedfolder.SharedFolder
76+
var _ FolderWithoutParent = FolderWithoutParent{
77+
SharedFolderId: "test_id",
78+
Name: "Test Folder",
79+
}
80+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package namespace
2+
3+
import (
4+
"testing"
5+
6+
"github.com/watermint/toolbox/infra/control/app_control"
7+
"github.com/watermint/toolbox/quality/recipe/qtr_endtoend"
8+
)
9+
10+
func TestList_PresetConfiguration(t *testing.T) {
11+
// The Preset method is called by the recipe framework after proper initialization
12+
// We can't test it directly in isolation as it requires initialized connections
13+
// Instead, we just verify the struct can be created
14+
list := &List{}
15+
if list == nil {
16+
t.Error("Expected List struct to be created")
17+
}
18+
}
19+
20+
func TestSummary_PresetConfiguration(t *testing.T) {
21+
// The Preset method is called by the recipe framework after proper initialization
22+
// We can't test it directly in isolation as it requires initialized connections
23+
// Instead, we just verify the struct can be created
24+
summary := &Summary{}
25+
if summary == nil {
26+
t.Error("Expected Summary struct to be created")
27+
}
28+
}
29+
30+
func TestList_TestMethod(t *testing.T) {
31+
// Test the Test method
32+
qtr_endtoend.TestWithControl(t, func(ctl app_control.Control) {
33+
list := &List{}
34+
// The Test method will likely fail in unit test context,
35+
// but we can verify it doesn't panic
36+
_ = list.Test(ctl)
37+
})
38+
}
39+
40+
func TestSummary_TestMethod(t *testing.T) {
41+
// Test the Test method
42+
qtr_endtoend.TestWithControl(t, func(ctl app_control.Control) {
43+
summary := &Summary{}
44+
// The Test method will likely fail in unit test context,
45+
// but we can verify it doesn't panic
46+
_ = summary.Test(ctl)
47+
})
48+
}
49+
50+
func TestSummary_SkipMemberSummaryFlag(t *testing.T) {
51+
summary := &Summary{}
52+
53+
// Test default value
54+
if summary.SkipMemberSummary {
55+
t.Error("Expected SkipMemberSummary to be false by default")
56+
}
57+
58+
// Test setting value
59+
summary.SkipMemberSummary = true
60+
if !summary.SkipMemberSummary {
61+
t.Error("Expected SkipMemberSummary to be true after setting")
62+
}
63+
}
64+
65+
func TestNamespaceTypes(t *testing.T) {
66+
// Test various namespace type strings used in the code
67+
namespaceTypes := []string{
68+
"app_folder",
69+
"team_member_folder",
70+
"team_member_root",
71+
"shared_folder",
72+
"team_folder",
73+
"team_folder (inside team folder)",
74+
}
75+
76+
for _, nt := range namespaceTypes {
77+
// Verify the strings are valid (non-empty)
78+
if nt == "" {
79+
t.Error("Namespace type should not be empty")
80+
}
81+
}
82+
}
83+
84+
func TestSummaryStructInitialization(t *testing.T) {
85+
// Test that Summary struct can be initialized with all fields
86+
summary := &Summary{
87+
SkipMemberSummary: true,
88+
// Other fields would be initialized by Preset()
89+
}
90+
91+
if !summary.SkipMemberSummary {
92+
t.Error("Expected SkipMemberSummary to be true")
93+
}
94+
}
95+
96+
func TestListStructInitialization(t *testing.T) {
97+
// Test that List struct can be initialized
98+
list := &List{}
99+
100+
// Verify the struct is not nil
101+
if list == nil {
102+
t.Error("Expected List struct to be initialized")
103+
}
104+
}

docs/_posts/2022-09-15-release-110.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

docs/_posts/2025-06-15-release-141.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,29 @@
22
layout: post
33
title: Release 141
44
lang: en
5-
release_page: https://github.com/watermint/toolbox/releases/latest
5+
release_page: https://github.com/watermint/toolbox/releases/tag/141.8.323
66
release: 141
77
---
88

9+
# Release theme
10+
11+
# Changes
12+
13+
* [Specification changes](https://github.com/watermint/toolbox/blob/141.8.323/docs/releases/changes141.md) (English)
14+
* [Specification changes](https://github.com/watermint/toolbox/blob/141.8.323/docs/releases/changes141.md) (日本語)
15+
16+
# Documents
17+
18+
* [README.md](https://github.com/watermint/toolbox/blob/141.8.323/README.md) (English)
19+
* [README_ja.md](https://github.com/watermint/toolbox/blob/141.8.323/README_ja.md) (日本語)
20+
21+
# Binary
22+
23+
| File name | File size | MD5 hash | SHA256 hash |
24+
|------------------------------------|-----------|----------------------------------|------------------------------------------------------------------|
25+
| tbx-141.8.323-linux-arm.zip | 22208869 | 872f54d8116161049a3da3c237f55b75 | 15955adfa2800b734e29b506e62f489ecdd6d4b9f05eb935577860b1ba30e9ae |
26+
| tbx-141.8.323-linux-intel.zip | 23552731 | 99752f5b9376014ee1e70b5b0df80bc2 | d64bace139787090460f79fa67220134b38f57d25438dfb60eea421e2a78d435 |
27+
| tbx-141.8.323-mac-applesilicon.zip | 22757694 | 700cf8d377a519fc4f17a1fcbc7244bb | 04901663733b9d88acb38a098893f76374aaa4163f4c8e08b93e9b899316a092 |
28+
| tbx-141.8.323-win.zip | 23821125 | 081bb08107280fb3243a87786e25c4d5 | 5e3f3a83aae7e32f785d8594fc495152ade9fef80f56c7c4e44753ce97f93077 |
29+
930

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
layout: post
3+
title: Release 142
4+
lang: en
5+
release_page: https://github.com/watermint/toolbox/releases/latest
6+
release: 142
7+
---
8+
9+

0 commit comments

Comments
 (0)