test: include coverage fixtures in native gates
This commit is contained in:
1 parent
089a661124
commit
7f07c22cd5
169 files changed
+679
-668
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMainExitsWithSuccessfulVersionCommand(t *testing.T) {
|
func TestCrossPlatformCoverageMainExitsWithSuccessfulVersionCommand(t *testing.T) {
|
||||||
previousExit := exit
|
previousExit := exit
|
||||||
previousArgs := os.Args
|
previousArgs := os.Args
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type failingWriter struct{ err error }
|
|||||||
|
|
||||||
func (w failingWriter) Write([]byte) (int, error) { return 0, w.err }
|
func (w failingWriter) Write([]byte) (int, error) { return 0, w.err }
|
||||||
|
|
||||||
func TestDryRunAndParseCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDryRunAndParseCoverageEdges(t *testing.T) {
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
base string
|
base string
|
||||||
path string
|
path string
|
||||||
@@ -63,7 +63,7 @@ func TestDryRunAndParseCoverageEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResponseHandlingCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageResponseHandlingCoverageEdges(t *testing.T) {
|
||||||
jsonHeader := http.Header{"Content-Type": []string{"application/json"}}
|
jsonHeader := http.Header{"Content-Type": []string{"application/json"}}
|
||||||
textHeader := http.Header{"Content-Type": []string{"text/plain"}}
|
textHeader := http.Header{"Content-Type": []string{"text/plain"}}
|
||||||
var out, errOut bytes.Buffer
|
var out, errOut bytes.Buffer
|
||||||
@@ -141,7 +141,7 @@ func TestResponseHandlingCoverageEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPaginationParsingAndInjectionEdges(t *testing.T) {
|
func TestCrossPlatformCoveragePaginationParsingAndInjectionEdges(t *testing.T) {
|
||||||
jsonHeader := http.Header{"Content-Type": []string{"application/json"}}
|
jsonHeader := http.Header{"Content-Type": []string{"application/json"}}
|
||||||
for _, resp := range []*RawAPIResponse{
|
for _, resp := range []*RawAPIResponse{
|
||||||
{StatusCode: 200, Header: http.Header{"Content-Type": []string{"text/plain"}}, Body: []byte("x")},
|
{StatusCode: 200, Header: http.Header{"Content-Type": []string{"text/plain"}}, Body: []byte("x")},
|
||||||
@@ -192,7 +192,7 @@ func jsonHTTPResponse(body string) *http.Response {
|
|||||||
return &http.Response{StatusCode: 200, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: io.NopCloser(strings.NewReader(body))}
|
return &http.Response{StatusCode: 200, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: io.NopCloser(strings.NewReader(body))}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPaginationControlFlowEdges(t *testing.T) {
|
func TestCrossPlatformCoveragePaginationControlFlowEdges(t *testing.T) {
|
||||||
wantErr := errors.New("transport failed")
|
wantErr := errors.New("transport failed")
|
||||||
client := NewClient("token", DefaultBaseURL)
|
client := NewClient("token", DefaultBaseURL)
|
||||||
client.HTTPClient.Transport = roundTripFunc(func(*http.Request) (*http.Response, error) {
|
client.HTTPClient.Transport = roundTripFunc(func(*http.Request) (*http.Response, error) {
|
||||||
@@ -245,7 +245,7 @@ func TestPaginationControlFlowEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientAndValidationFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageClientAndValidationFailureEdges(t *testing.T) {
|
||||||
client := NewClient("token", DefaultBaseURL)
|
client := NewClient("token", DefaultBaseURL)
|
||||||
if _, err := client.Do(context.Background(), RawAPIRequest{Method: "GET", Path: "https://api.dingtalk.com/%zz"}); err == nil {
|
if _, err := client.Do(context.Background(), RawAPIRequest{Method: "GET", Path: "https://api.dingtalk.com/%zz"}); err == nil {
|
||||||
t.Fatal("Do with invalid URL should fail")
|
t.Fatal("Do with invalid URL should fail")
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ func docPreflightServer(t *testing.T, result map[string]any) *httptest.Server {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDocDownloadPreflightCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDocDownloadPreflightCoverage(t *testing.T) {
|
||||||
runner := &runtimeRunner{}
|
runner := &runtimeRunner{}
|
||||||
base := executor.Invocation{CanonicalProduct: "doc", Tool: "download_file", Params: map[string]any{"nodeId": " node "}}
|
base := executor.Invocation{CanonicalProduct: "doc", Tool: "download_file", Params: map[string]any{"nodeId": " node "}}
|
||||||
if err := runner.preflightDocDownload(context.Background(), transport.NewClient(nil), "", executor.Invocation{}); err != nil {
|
if err := runner.preflightDocDownload(context.Background(), transport.NewClient(nil), "", executor.Invocation{}); err != nil {
|
||||||
@@ -137,7 +137,7 @@ func TestDocDownloadPreflightCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRootHelpRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRootHelpRemainingCoverage(t *testing.T) {
|
||||||
configureRootHelp(nil)
|
configureRootHelp(nil)
|
||||||
renderRootGlobalFlags(nil)
|
renderRootGlobalFlags(nil)
|
||||||
if visiblePersistentFlags(nil) != nil || formatRootFlag(nil) != "" || commandShort(nil) != "" || visibleMCPRootCommands(nil) != nil || visibleUtilityRootCommands(nil) != nil {
|
if visiblePersistentFlags(nil) != nil || formatRootFlag(nil) != "" || commandShort(nil) != "" || visibleMCPRootCommands(nil) != nil || visibleUtilityRootCommands(nil) != nil {
|
||||||
@@ -178,7 +178,7 @@ func TestRootHelpRemainingCoverage(t *testing.T) {
|
|||||||
_ = visibleMCPRootCommands(root)
|
_ = visibleMCPRootCommands(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigAndTokenSeamsCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConfigAndTokenSeamsCoverage(t *testing.T) {
|
||||||
oldHome, oldExe, oldEval := userHomeDir, executablePath, evaluateSymlink
|
oldHome, oldExe, oldEval := userHomeDir, executablePath, evaluateSymlink
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -239,7 +239,7 @@ func TestConfigAndTokenSeamsCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestForceRefreshAndStdioFailureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageForceRefreshAndStdioFailureCoverage(t *testing.T) {
|
||||||
oldMark, oldFactory := markAccessTokenStale, newRefreshProvider
|
oldMark, oldFactory := markAccessTokenStale, newRefreshProvider
|
||||||
oldStop := stopStdio
|
oldStop := stopStdio
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -287,7 +287,7 @@ func TestForceRefreshAndStdioFailureCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOverlayRecoveryHostAndHelperRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageOverlayRecoveryHostAndHelperRemainingCoverage(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
writeOverlay := filepath.Join(root, "overlay.json")
|
writeOverlay := filepath.Join(root, "overlay.json")
|
||||||
if err := os.WriteFile(writeOverlay, []byte(`{"toolOverrides":{"tool":{}}}`), 0o600); err != nil {
|
if err := os.WriteFile(writeOverlay, []byte(`{"toolOverrides":{"tool":{}}}`), 0o600); err != nil {
|
||||||
@@ -342,7 +342,7 @@ func TestOverlayRecoveryHostAndHelperRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigAndCacheCommandRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConfigAndCacheCommandRemainingCoverage(t *testing.T) {
|
||||||
for _, command := range []*cobra.Command{newConfigCommand(), newCacheCommand()} {
|
for _, command := range []*cobra.Command{newConfigCommand(), newCacheCommand()} {
|
||||||
command.SetOut(io.Discard)
|
command.SetOut(io.Discard)
|
||||||
if err := command.RunE(command, nil); err != nil {
|
if err := command.RunE(command, nil); err != nil {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAPIAndTimingRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAPIAndTimingRemainingCoverage(t *testing.T) {
|
||||||
oldProvider := newAppTokenProvider
|
oldProvider := newAppTokenProvider
|
||||||
oldClientID, oldClientSecret := apiClientID, apiClientSecret
|
oldClientID, oldClientSecret := apiClientID, apiClientSecret
|
||||||
oldMarshal, oldMkdir := timingMarshalIndent, timingMkdirAll
|
oldMarshal, oldMkdir := timingMarshalIndent, timingMkdirAll
|
||||||
@@ -114,7 +114,7 @@ func TestAPIAndTimingRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDirectRuntimeRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDirectRuntimeRemainingCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
edition.Override(oldEdition)
|
edition.Override(oldEdition)
|
||||||
@@ -214,7 +214,7 @@ func containsText(value, substring string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEmbeddedSkillAndTinyCommandsRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEmbeddedSkillAndTinyCommandsRemainingCoverage(t *testing.T) {
|
||||||
oldStat, oldTemp, oldRemove := embeddedSkillStat, embeddedSkillMkdirTemp, embeddedSkillRemoveAll
|
oldStat, oldTemp, oldRemove := embeddedSkillStat, embeddedSkillMkdirTemp, embeddedSkillRemoveAll
|
||||||
oldWalk, oldRead := embeddedSkillWalkDir, embeddedSkillReadFile
|
oldWalk, oldRead := embeddedSkillWalkDir, embeddedSkillReadFile
|
||||||
oldMkdir, oldWrite := embeddedSkillMkdirAll, embeddedSkillWriteFile
|
oldMkdir, oldWrite := embeddedSkillMkdirAll, embeddedSkillWriteFile
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func (sink *auditCoverageSink) Emit(event *audit.Event) error {
|
|||||||
|
|
||||||
func (sink *auditCoverageSink) Close() error { return sink.closeErr }
|
func (sink *auditCoverageSink) Close() error { return sink.closeErr }
|
||||||
|
|
||||||
func TestAuditCommandsAndFileHelpersCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAuditCommandsAndFileHelpersCoverage(t *testing.T) {
|
||||||
originalExit, originalVerify := auditExit, auditVerify
|
originalExit, originalVerify := auditExit, auditVerify
|
||||||
t.Cleanup(func() { auditExit, auditVerify = originalExit, originalVerify })
|
t.Cleanup(func() { auditExit, auditVerify = originalExit, originalVerify })
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
@@ -193,7 +193,7 @@ func TestAuditCommandsAndFileHelpersCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuditRuntimeCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAuditRuntimeCoverage(t *testing.T) {
|
||||||
previousSink, previousLoader := sharedAuditSink, loadTokenForProfile
|
previousSink, previousLoader := sharedAuditSink, loadTokenForProfile
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
sharedAuditSink = previousSink
|
sharedAuditSink = previousSink
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ func authCoverageRunLogin(t *testing.T, caller edition.ToolCaller, format string
|
|||||||
return out.String(), errOut.String(), err
|
return out.String(), errOut.String(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthCoverageFormsParentAndTargets(t *testing.T) {
|
func TestCrossPlatformCoverageAuthCoverageFormsParentAndTargets(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldRunForm := authRunForm
|
oldRunForm := authRunForm
|
||||||
oldPrompt := authLoginManualCredentialsPrompt
|
oldPrompt := authLoginManualCredentialsPrompt
|
||||||
@@ -206,7 +206,7 @@ func TestAuthCoverageFormsParentAndTargets(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthCoverageLoginFlows(t *testing.T) {
|
func TestCrossPlatformCoverageAuthCoverageLoginFlows(t *testing.T) {
|
||||||
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
||||||
oldSave := authSaveTokenData
|
oldSave := authSaveTokenData
|
||||||
oldDevice := authDeviceLogin
|
oldDevice := authDeviceLogin
|
||||||
@@ -335,7 +335,7 @@ func TestAuthCoverageLoginFlows(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthCoverageContactEnrichment(t *testing.T) {
|
func TestCrossPlatformCoverageAuthCoverageContactEnrichment(t *testing.T) {
|
||||||
oldSave := authSaveTokenData
|
oldSave := authSaveTokenData
|
||||||
t.Cleanup(func() { authSaveTokenData = oldSave })
|
t.Cleanup(func() { authSaveTokenData = oldSave })
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
@@ -387,7 +387,7 @@ func TestAuthCoverageContactEnrichment(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthCoverageDefaultSeamClosures(t *testing.T) {
|
func TestCrossPlatformCoverageAuthCoverageDefaultSeamClosures(t *testing.T) {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
cancel()
|
cancel()
|
||||||
configDir := t.TempDir()
|
configDir := t.TempDir()
|
||||||
@@ -401,7 +401,7 @@ func TestAuthCoverageDefaultSeamClosures(t *testing.T) {
|
|||||||
_ = fmt.Sprintf("%v", os.ErrNotExist)
|
_ = fmt.Sprintf("%v", os.ErrNotExist)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthCoverageStatusAndLogout(t *testing.T) {
|
func TestCrossPlatformCoverageAuthCoverageStatusAndLogout(t *testing.T) {
|
||||||
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldStatus := authOAuthStatus
|
oldStatus := authOAuthStatus
|
||||||
@@ -589,7 +589,7 @@ func TestAuthCoverageStatusAndLogout(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthCoveragePortableExchangeAndReset(t *testing.T) {
|
func TestCrossPlatformCoverageAuthCoveragePortableExchangeAndReset(t *testing.T) {
|
||||||
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldSupported := authPortableExportSupported
|
oldSupported := authPortableExportSupported
|
||||||
|
|||||||
@@ -62,3 +62,9 @@ func TestAuthMigrateKeychainRemainingBranches(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep the original test name for the focused macOS auth workflow while also
|
||||||
|
// opting the coverage fixture into the native platform coverage gate.
|
||||||
|
func TestCrossPlatformCoverageAuthMigrateKeychainRemainingBranches(t *testing.T) {
|
||||||
|
TestAuthMigrateKeychainRemainingBranches(t)
|
||||||
|
}
|
||||||
@@ -63,7 +63,7 @@ type coverageRawStderr string
|
|||||||
func (e coverageRawStderr) Error() string { return string(e) }
|
func (e coverageRawStderr) Error() string { return string(e) }
|
||||||
func (e coverageRawStderr) RawStderr() string { return string(e) }
|
func (e coverageRawStderr) RawStderr() string { return string(e) }
|
||||||
|
|
||||||
func TestToolCallerAdapterCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageToolCallerAdapterCoverage(t *testing.T) {
|
||||||
runner := &coverageRunner{}
|
runner := &coverageRunner{}
|
||||||
adapter := newToolCallerAdapter(runner, nil).(*toolCallerAdapter)
|
adapter := newToolCallerAdapter(runner, nil).(*toolCallerAdapter)
|
||||||
if adapter.Format() != "json" || adapter.DryRun() || adapter.Fields() != "" || adapter.JQ() != "" {
|
if adapter.Format() != "json" || adapter.DryRun() || adapter.Fields() != "" || adapter.JQ() != "" {
|
||||||
@@ -100,7 +100,7 @@ func TestToolCallerAdapterCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunnerPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRunnerPureCoverage(t *testing.T) {
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
content map[string]any
|
content map[string]any
|
||||||
want string
|
want string
|
||||||
@@ -185,7 +185,7 @@ func TestRunnerPureCoverage(t *testing.T) {
|
|||||||
ResetRuntimeTokenCache()
|
ResetRuntimeTokenCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDocDownloadPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDocDownloadPureCoverage(t *testing.T) {
|
||||||
for _, inv := range []executor.Invocation{
|
for _, inv := range []executor.Invocation{
|
||||||
{},
|
{},
|
||||||
{CanonicalProduct: "DOC", Tool: docDownloadFileTool},
|
{CanonicalProduct: "DOC", Tool: docDownloadFileTool},
|
||||||
@@ -215,7 +215,7 @@ func TestDocDownloadPureCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRecoveryPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRecoveryPureCoverage(t *testing.T) {
|
||||||
if _, err := decodeRecoveryAttempts(nil, nil, "", ""); err != nil {
|
if _, err := decodeRecoveryAttempts(nil, nil, "", ""); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ func TestRecoveryPureCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSmallAppRegistryAndRootCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSmallAppRegistryAndRootCoverage(t *testing.T) {
|
||||||
RegisterPluginAuth("coverage-registry", &PluginAuth{Token: "token"})
|
RegisterPluginAuth("coverage-registry", &PluginAuth{Token: "token"})
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
pluginAuthMu.Lock()
|
pluginAuthMu.Lock()
|
||||||
@@ -422,7 +422,7 @@ func TestSmallAppRegistryAndRootCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDirectRuntimeCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDirectRuntimeCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
t.Cleanup(func() { edition.Override(oldEdition); SetDynamicServers(nil) })
|
t.Cleanup(func() { edition.Override(oldEdition); SetDynamicServers(nil) })
|
||||||
server := mcptypes.ServerDescriptor{
|
server := mcptypes.ServerDescriptor{
|
||||||
@@ -503,7 +503,7 @@ func TestDirectRuntimeCoverage(t *testing.T) {
|
|||||||
_ = defaultPATMCPEndpoint()
|
_ = defaultPATMCPEndpoint()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRecoveryLoadExecutionCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRecoveryLoadExecutionCoverage(t *testing.T) {
|
||||||
if _, err := loadRecoveryExecution(filepath.Join(t.TempDir(), "missing")); err == nil {
|
if _, err := loadRecoveryExecution(filepath.Join(t.TempDir(), "missing")); err == nil {
|
||||||
t.Fatal("missing recovery execution succeeded")
|
t.Fatal("missing recovery execution succeeded")
|
||||||
}
|
}
|
||||||
@@ -529,7 +529,7 @@ func TestRecoveryLoadExecutionCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRecoveryRuntimeHTTP(t *testing.T) {
|
func TestCrossPlatformCoverageRecoveryRuntimeHTTP(t *testing.T) {
|
||||||
var result map[string]any = map[string]any{"content": []map[string]any{{"type": "text", "text": `{"items":[{"title":"query result","url":"u"}]}`}}}
|
var result map[string]any = map[string]any{"content": []map[string]any{{"type": "text", "text": `{"items":[{"title":"query result","url":"u"}]}`}}}
|
||||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req struct {
|
var req struct {
|
||||||
@@ -556,7 +556,7 @@ func TestRecoveryRuntimeHTTP(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventCommandPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventCommandPureCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
t.Cleanup(func() { edition.Override(oldEdition) })
|
t.Cleanup(func() { edition.Override(oldEdition) })
|
||||||
edition.Override(&edition.Hooks{})
|
edition.Override(&edition.Hooks{})
|
||||||
@@ -626,7 +626,7 @@ func TestEventCommandPureCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventListAndStatusCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventListAndStatusCoverage(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
t.Setenv("DWS_CONFIG_DIR", dir)
|
t.Setenv("DWS_CONFIG_DIR", dir)
|
||||||
cmd := &cobra.Command{Use: "event"}
|
cmd := &cobra.Command{Use: "event"}
|
||||||
@@ -684,7 +684,7 @@ func TestEventListAndStatusCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventCommandValidationCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventCommandValidationCoverage(t *testing.T) {
|
||||||
execute := func(t *testing.T, cmd *cobra.Command, args ...string) error {
|
execute := func(t *testing.T, cmd *cobra.Command, args ...string) error {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
cmd.SilenceErrors = true
|
cmd.SilenceErrors = true
|
||||||
@@ -724,7 +724,7 @@ func TestEventCommandValidationCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVersionCacheCompletionCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageVersionCacheCompletionCoverage(t *testing.T) {
|
||||||
oldVersion, oldBuild, oldCommit := version, buildTime, gitCommit
|
oldVersion, oldBuild, oldCommit := version, buildTime, gitCommit
|
||||||
t.Cleanup(func() { version, buildTime, gitCommit = oldVersion, oldBuild, oldCommit })
|
t.Cleanup(func() { version, buildTime, gitCommit = oldVersion, oldBuild, oldCommit })
|
||||||
version, buildTime, gitCommit = "1.0", "unknown", "unknown"
|
version, buildTime, gitCommit = "1.0", "unknown", "unknown"
|
||||||
@@ -776,7 +776,7 @@ func TestVersionCacheCompletionCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeRunnerRoutingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeRunnerRoutingCoverage(t *testing.T) {
|
||||||
inv := executor.Invocation{CanonicalProduct: "product", Tool: "tool", Params: map[string]any{"x": 1}}
|
inv := executor.Invocation{CanonicalProduct: "product", Tool: "tool", Params: map[string]any{"x": 1}}
|
||||||
fallback := &coverageRunner{result: executor.Result{Response: map[string]any{"fallback": true}}}
|
fallback := &coverageRunner{result: executor.Result{Response: map[string]any{"fallback": true}}}
|
||||||
r := &runtimeRunner{fallback: fallback}
|
r := &runtimeRunner{fallback: fallback}
|
||||||
@@ -851,7 +851,7 @@ func TestRuntimeRunnerRoutingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExecuteInvocationCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageExecuteInvocationCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
edition.Override(&edition.Hooks{TokenProvider: func(context.Context, func() (string, error)) (string, error) {
|
edition.Override(&edition.Hooks{TokenProvider: func(context.Context, func() (string, error)) (string, error) {
|
||||||
return "", nil
|
return "", nil
|
||||||
@@ -953,7 +953,7 @@ func TestExecuteInvocationCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthCommandPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAuthCommandPureCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldPrompt := authLoginManualCredentialsPrompt
|
oldPrompt := authLoginManualCredentialsPrompt
|
||||||
oldInteractive := authLoginInteractiveTerminal
|
oldInteractive := authLoginInteractiveTerminal
|
||||||
@@ -1078,7 +1078,7 @@ func TestAuthCommandPureCoverage(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthLoginTokenCommandCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAuthLoginTokenCommandCoverage(t *testing.T) {
|
||||||
oldInteractive := authLoginInteractiveTerminal
|
oldInteractive := authLoginInteractiveTerminal
|
||||||
authLoginInteractiveTerminal = func() bool { return false }
|
authLoginInteractiveTerminal = func() bool { return false }
|
||||||
t.Cleanup(func() { authLoginInteractiveTerminal = oldInteractive; authpkg.SetRuntimeProfile("") })
|
t.Cleanup(func() { authLoginInteractiveTerminal = oldInteractive; authpkg.SetRuntimeProfile("") })
|
||||||
@@ -1118,7 +1118,7 @@ func TestAuthLoginTokenCommandCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPluginCommandLifecycleCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePluginCommandLifecycleCoverage(t *testing.T) {
|
||||||
home := t.TempDir()
|
home := t.TempDir()
|
||||||
work := t.TempDir()
|
work := t.TempDir()
|
||||||
t.Setenv("HOME", home)
|
t.Setenv("HOME", home)
|
||||||
@@ -1281,7 +1281,7 @@ func TestPluginCommandLifecycleCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUpgradeCommandHTTPAndDryRunCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageUpgradeCommandHTTPAndDryRunCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldVersion := version
|
oldVersion := version
|
||||||
t.Cleanup(func() { edition.Override(oldEdition); version = oldVersion })
|
t.Cleanup(func() { edition.Override(oldEdition); version = oldVersion })
|
||||||
@@ -1375,7 +1375,7 @@ func TestUpgradeCommandHTTPAndDryRunCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUpgradeRemainingPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageUpgradeRemainingPureCoverage(t *testing.T) {
|
||||||
originalCommandOutput := upgradeCommandOutput
|
originalCommandOutput := upgradeCommandOutput
|
||||||
t.Cleanup(func() { upgradeCommandOutput = originalCommandOutput })
|
t.Cleanup(func() { upgradeCommandOutput = originalCommandOutput })
|
||||||
for _, beta := range []bool{false, true} {
|
for _, beta := range []bool{false, true} {
|
||||||
@@ -1439,7 +1439,7 @@ func TestUpgradeRemainingPureCoverage(t *testing.T) {
|
|||||||
_ = shortenHome(filepath.Join(os.Getenv("HOME"), "path"))
|
_ = shortenHome(filepath.Join(os.Getenv("HOME"), "path"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalEventPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalEventPureCoverage(t *testing.T) {
|
||||||
cmd := &cobra.Command{Use: "personal"}
|
cmd := &cobra.Command{Use: "personal"}
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
cmd.SetOut(&out)
|
cmd.SetOut(&out)
|
||||||
@@ -1576,7 +1576,7 @@ func personalCommonOptions(eventTypes []string, filter string) commonConsumeOpti
|
|||||||
return commonConsumeOptions{EventTypes: eventTypes, Filter: filter}
|
return commonConsumeOptions{EventTypes: eventTypes, Filter: filter}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalSubscriptionAndSourceCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalSubscriptionAndSourceCoverage(t *testing.T) {
|
||||||
identity := personal.Identity{AccessToken: "token", CorpID: "corp", UserID: "user", ClientID: "client", SourceID: "source"}
|
identity := personal.Identity{AccessToken: "token", CorpID: "corp", UserID: "user", ClientID: "client", SourceID: "source"}
|
||||||
var createCount, cancelCount int
|
var createCount, cancelCount int
|
||||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
@@ -1639,7 +1639,7 @@ func TestPersonalSubscriptionAndSourceCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalEventCommandRuntimeCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalEventCommandRuntimeCoverage(t *testing.T) {
|
||||||
configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{
|
configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{
|
||||||
AccessToken: "access", RefreshToken: "refresh", ExpiresAt: time.Now().Add(time.Hour),
|
AccessToken: "access", RefreshToken: "refresh", ExpiresAt: time.Now().Add(time.Hour),
|
||||||
CorpID: "corp", UserID: "user", ClientID: "client",
|
CorpID: "corp", UserID: "user", ClientID: "client",
|
||||||
@@ -1700,7 +1700,7 @@ func TestPersonalEventCommandRuntimeCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDoctorCommandCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDoctorCommandCoverage(t *testing.T) {
|
||||||
configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{
|
configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{
|
||||||
AccessToken: "access", ExpiresAt: time.Now().Add(time.Hour), ClientID: "client",
|
AccessToken: "access", ExpiresAt: time.Now().Add(time.Hour), ClientID: "client",
|
||||||
})
|
})
|
||||||
@@ -1817,7 +1817,7 @@ func coverageSkillZip(t *testing.T) []byte {
|
|||||||
return buf.Bytes()
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillCommandHTTPCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillCommandHTTPCoverage(t *testing.T) {
|
||||||
configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{AccessToken: "access", ExpiresAt: time.Now().Add(time.Hour), ClientID: "client"})
|
configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{AccessToken: "access", ExpiresAt: time.Now().Add(time.Hour), ClientID: "client"})
|
||||||
t.Setenv("DWS_CONFIG_DIR", configDir)
|
t.Setenv("DWS_CONFIG_DIR", configDir)
|
||||||
home := t.TempDir()
|
home := t.TempDir()
|
||||||
@@ -1904,7 +1904,7 @@ func serverURL(r *http.Request) string {
|
|||||||
return "http://" + r.Host
|
return "http://" + r.Host
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillHelpersAndErrorsCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillHelpersAndErrorsCoverage(t *testing.T) {
|
||||||
oldEmbedded := edition.Get()
|
oldEmbedded := edition.Get()
|
||||||
t.Cleanup(func() { edition.Override(oldEmbedded) })
|
t.Cleanup(func() { edition.Override(oldEmbedded) })
|
||||||
for _, embedded := range []bool{false, true} {
|
for _, embedded := range []bool{false, true} {
|
||||||
@@ -1985,7 +1985,7 @@ func TestSkillHelpersAndErrorsCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProfileCommandAndModelCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageProfileCommandAndModelCoverage(t *testing.T) {
|
||||||
configDir := t.TempDir()
|
configDir := t.TempDir()
|
||||||
t.Setenv("DWS_CONFIG_DIR", configDir)
|
t.Setenv("DWS_CONFIG_DIR", configDir)
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
@@ -2134,7 +2134,7 @@ func TestProfileCommandAndModelCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillSetupRuntimeCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillSetupRuntimeCoverage(t *testing.T) {
|
||||||
home := t.TempDir()
|
home := t.TempDir()
|
||||||
oldSetupHome := skillSetupUserHomeDir
|
oldSetupHome := skillSetupUserHomeDir
|
||||||
skillSetupUserHomeDir = func() (string, error) { return home, nil }
|
skillSetupUserHomeDir = func() (string, error) { return home, nil }
|
||||||
@@ -2202,7 +2202,7 @@ func TestSkillSetupRuntimeCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillSetupPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillSetupPureCoverage(t *testing.T) {
|
||||||
all := []string{"dingtalk-a", "dingtalk-b", "dws-shared"}
|
all := []string{"dingtalk-a", "dingtalk-b", "dws-shared"}
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
include []string
|
include []string
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ func appRPCServer(t *testing.T, initOK, listOK bool) *httptest.Server {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPluginAuthCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePluginAuthCoverage(t *testing.T) {
|
||||||
registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "fallback", Endpoint: "%", AuthHeaders: map[string]string{"Authorization": "token"}})
|
registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "fallback", Endpoint: "%", AuthHeaders: map[string]string{"Authorization": "token"}})
|
||||||
registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "server", Endpoint: "https://x.test", CLI: mcptypes.CLIOverlay{ID: "cli"}, AuthHeaders: map[string]string{"Authorization": "Bearer token", "X": "Y"}})
|
registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "server", Endpoint: "https://x.test", CLI: mcptypes.CLIOverlay{ID: "cli"}, AuthHeaders: map[string]string{"Authorization": "Bearer token", "X": "Y"}})
|
||||||
registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "none"})
|
registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "none"})
|
||||||
@@ -68,7 +68,7 @@ func TestPluginAuthCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRawAPIAndTokenCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRawAPIAndTokenCoverage(t *testing.T) {
|
||||||
oldProvider := newAccessTokenProvider
|
oldProvider := newAccessTokenProvider
|
||||||
oldManager := newLegacyTokenManager
|
oldManager := newLegacyTokenManager
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -178,7 +178,7 @@ func TestRawAPIAndTokenCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRootUtilityAndTimingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRootUtilityAndTimingCoverage(t *testing.T) {
|
||||||
_ = resolveVerbosity(nil)
|
_ = resolveVerbosity(nil)
|
||||||
for _, flags := range []struct {
|
for _, flags := range []struct {
|
||||||
debug bool
|
debug bool
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition"
|
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDoctorRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDoctorRemainingCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldDiagnose := doctorKeychainDiagnose
|
oldDiagnose := doctorKeychainDiagnose
|
||||||
oldStatus := doctorAuthStatus
|
oldStatus := doctorAuthStatus
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEventConsumeCommandAllBranchesCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventConsumeCommandAllBranchesCoverage(t *testing.T) {
|
||||||
oldPersonal := eventRunPersonalConsume
|
oldPersonal := eventRunPersonalConsume
|
||||||
oldCreds, oldConsume, oldForeground := eventResolveCredentials, eventConsumeRun, eventRunForeground
|
oldCreds, oldConsume, oldForeground := eventResolveCredentials, eventConsumeRun, eventRunForeground
|
||||||
oldNormalize := eventNormalizeAs
|
oldNormalize := eventNormalizeAs
|
||||||
@@ -113,7 +113,7 @@ func TestEventConsumeCommandAllBranchesCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventSourcesAndForegroundCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventSourcesAndForegroundCoverage(t *testing.T) {
|
||||||
oldNew, oldToken, oldEventSource, oldBus := eventNewDingtalkSource, eventResolveAccessToken, eventNewEventSource, eventBusRun
|
oldNew, oldToken, oldEventSource, oldBus := eventNewDingtalkSource, eventResolveAccessToken, eventNewEventSource, eventBusRun
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -175,7 +175,7 @@ func TestEventSourcesAndForegroundCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventBusCommandAllBranchesCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventBusCommandAllBranchesCoverage(t *testing.T) {
|
||||||
oldReady, oldPersonal, oldPersonalSource := eventReadyFDFromEnv, eventResolvePersonal, eventNewPersonalSource
|
oldReady, oldPersonal, oldPersonalSource := eventReadyFDFromEnv, eventResolvePersonal, eventNewPersonalSource
|
||||||
oldCreds, oldSource, oldRun := eventResolveCredentials, eventNewEventSource, eventBusRun
|
oldCreds, oldSource, oldRun := eventResolveCredentials, eventNewEventSource, eventBusRun
|
||||||
oldMkdir, oldOpen := eventMkdirAll, eventOpenFile
|
oldMkdir, oldOpen := eventMkdirAll, eventOpenFile
|
||||||
@@ -252,7 +252,7 @@ func TestEventBusCommandAllBranchesCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventListStatusCollectAndStopCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventListStatusCollectAndStopCoverage(t *testing.T) {
|
||||||
oldList, oldStatus, oldStopPersonal := eventRunPersonalList, eventRunPersonalStatus, eventRunPersonalStop
|
oldList, oldStatus, oldStopPersonal := eventRunPersonalList, eventRunPersonalStatus, eventRunPersonalStop
|
||||||
oldEnum, oldFind, oldQuery, oldStop := eventEnumerateBuses, eventFindBus, eventQueryEntry, eventStopBus
|
oldEnum, oldFind, oldQuery, oldStop := eventEnumerateBuses, eventFindBus, eventQueryEntry, eventStopBus
|
||||||
oldCreds := eventResolveAppCredentials
|
oldCreds := eventResolveAppCredentials
|
||||||
@@ -396,7 +396,7 @@ func TestEventListStatusCollectAndStopCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventCommandParentCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventCommandParentCoverage(t *testing.T) {
|
||||||
cmd := newEventCommand()
|
cmd := newEventCommand()
|
||||||
cmd.SetOut(io.Discard)
|
cmd.SetOut(io.Discard)
|
||||||
if err := cmd.RunE(cmd, nil); err != nil {
|
if err := cmd.RunE(cmd, nil); err != nil {
|
||||||
@@ -407,7 +407,7 @@ func TestEventCommandParentCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventCommandPureAndRenderBranchesCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventCommandPureAndRenderBranchesCoverage(t *testing.T) {
|
||||||
t.Setenv(authpkg.EnvClientID, "client")
|
t.Setenv(authpkg.EnvClientID, "client")
|
||||||
t.Setenv(authpkg.EnvClientSecret, "secret")
|
t.Setenv(authpkg.EnvClientSecret, "secret")
|
||||||
if got := (eventStreamTicketOptions{Mode: "custom", SourceID: " source ", TicketURL: " https://ticket "}).spawnArgs(); len(got) != 6 {
|
if got := (eventStreamTicketOptions{Mode: "custom", SourceID: " source ", TicketURL: " https://ticket "}).spawnArgs(); len(got) != 6 {
|
||||||
@@ -495,7 +495,7 @@ func TestEventCommandPureAndRenderBranchesCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEventCommandClosureErrorBranchesCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventCommandClosureErrorBranchesCoverage(t *testing.T) {
|
||||||
oldNormalize := eventNormalizeAs
|
oldNormalize := eventNormalizeAs
|
||||||
oldList, oldStatus := eventRunPersonalList, eventRunPersonalStatus
|
oldList, oldStatus := eventRunPersonalList, eventRunPersonalStatus
|
||||||
oldCreds, oldFind, oldQuery := eventResolveAppCredentials, eventFindBus, eventQueryEntry
|
oldCreds, oldFind, oldQuery := eventResolveAppCredentials, eventFindBus, eventQueryEntry
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPersonalEventRemainingSchemaAndSubscriptionCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalEventRemainingSchemaAndSubscriptionCoverage(t *testing.T) {
|
||||||
for _, args := range [][]string{
|
for _, args := range [][]string{
|
||||||
{"known", "--as", "app"},
|
{"known", "--as", "app"},
|
||||||
{"not-a-real-event"},
|
{"not-a-real-event"},
|
||||||
@@ -74,7 +74,7 @@ func TestPersonalEventRemainingSchemaAndSubscriptionCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalEventRemainingConsumeCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalEventRemainingConsumeCoverage(t *testing.T) {
|
||||||
oldIdentity := personalResolveEventIdentity
|
oldIdentity := personalResolveEventIdentity
|
||||||
oldEnsure := personalEnsureSubscription
|
oldEnsure := personalEnsureSubscription
|
||||||
oldUpsert := personalUpsertRunState
|
oldUpsert := personalUpsertRunState
|
||||||
@@ -172,7 +172,7 @@ func TestPersonalEventRemainingConsumeCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalEventRemainingStatusStopAndInterruptCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalEventRemainingStatusStopAndInterruptCoverage(t *testing.T) {
|
||||||
oldIdentity := personalResolveEventIdentity
|
oldIdentity := personalResolveEventIdentity
|
||||||
oldFindBus := personalFindBusByIdentity
|
oldFindBus := personalFindBusByIdentity
|
||||||
oldQueryEntry := personalQueryEntry
|
oldQueryEntry := personalQueryEntry
|
||||||
@@ -296,7 +296,7 @@ func TestPersonalEventRemainingStatusStopAndInterruptCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalEventRemainingIdentityAndSourceCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalEventRemainingIdentityAndSourceCoverage(t *testing.T) {
|
||||||
oldAux := personalResolveAuxiliaryAccessToken
|
oldAux := personalResolveAuxiliaryAccessToken
|
||||||
oldLoad := personalLoadTokenData
|
oldLoad := personalLoadTokenData
|
||||||
oldClientID := personalClientID
|
oldClientID := personalClientID
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/executor"
|
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/executor"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPATRetryRemainingPureAndWaitCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePATRetryRemainingPureAndWaitCoverage(t *testing.T) {
|
||||||
typed := apperrors.NewAPI("ordinary", apperrors.WithHint("insufficient_scope"))
|
typed := apperrors.NewAPI("ordinary", apperrors.WithHint("insufficient_scope"))
|
||||||
if !isPatScopeError(typed) {
|
if !isPatScopeError(typed) {
|
||||||
t.Fatal("typed insufficient_scope was not recognized")
|
t.Fatal("typed insufficient_scope was not recognized")
|
||||||
@@ -88,7 +88,7 @@ func TestPATRetryRemainingPureAndWaitCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPATRetryRemainingOrchestrationCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePATRetryRemainingOrchestrationCoverage(t *testing.T) {
|
||||||
oldWait := patWaitForAuthorization
|
oldWait := patWaitForAuthorization
|
||||||
oldPoll := patPollDeviceFlowWithInterval
|
oldPoll := patPollDeviceFlowWithInterval
|
||||||
oldSaveApp := patSaveAppConfig
|
oldSaveApp := patSaveAppConfig
|
||||||
@@ -212,7 +212,7 @@ func patRaw(flowID, clientID, secret string) string {
|
|||||||
return `{"code":"x","data":{"desc":"authorize","flowId":"` + flowID + `","uri":"https://auth.test","clientId":"` + clientID + `","clientSecret":"` + secret + `"}}`
|
return `{"code":"x","data":{"desc":"authorize","flowId":"` + flowID + `","uri":"https://auth.test","clientId":"` + clientID + `","clientSecret":"` + secret + `"}}`
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPATRetryRemainingPollAndBrowserCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePATRetryRemainingPollAndBrowserCoverage(t *testing.T) {
|
||||||
oldDo := patPollHTTPDo
|
oldDo := patPollHTTPDo
|
||||||
oldRequest := patPollNewRequest
|
oldRequest := patPollNewRequest
|
||||||
oldLoad := patLoadTokenData
|
oldLoad := patLoadTokenData
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func pluginCoverageRun(cmd *cobra.Command, args ...string) (string, error) {
|
|||||||
return out.String(), err
|
return out.String(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPluginCommandRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePluginCommandRemainingCoverage(t *testing.T) {
|
||||||
oldGit := pluginInstallFromGit
|
oldGit := pluginInstallFromGit
|
||||||
oldStat := pluginStat
|
oldStat := pluginStat
|
||||||
oldMkdir := pluginMkdirAll
|
oldMkdir := pluginMkdirAll
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProfileRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageProfileRemainingCoverage(t *testing.T) {
|
||||||
oldMigrate := profileEnsureProfilesMigration
|
oldMigrate := profileEnsureProfilesMigration
|
||||||
oldLoad := profileLoadProfiles
|
oldLoad := profileLoadProfiles
|
||||||
oldPrevious := profileUsePrevious
|
oldPrevious := profileUsePrevious
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func recoveryCoverageRun(cmdArgs ...string) (string, error) {
|
|||||||
return out.String(), err
|
return out.String(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRecoveryCommandRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRecoveryCommandRemainingCoverage(t *testing.T) {
|
||||||
oldSavePlan, oldSaveAnalysis := recoverySavePlan, recoverySaveAnalysis
|
oldSavePlan, oldSaveAnalysis := recoverySavePlan, recoverySaveAnalysis
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
recoverySavePlan, recoverySaveAnalysis = oldSavePlan, oldSaveAnalysis
|
recoverySavePlan, recoverySaveAnalysis = oldSavePlan, oldSaveAnalysis
|
||||||
@@ -114,7 +114,7 @@ func TestRecoveryCommandRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRecoveryExecutionAndRuntimeRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRecoveryExecutionAndRuntimeRemainingCoverage(t *testing.T) {
|
||||||
t.Setenv("DINGTALK_DEVDOC_MCP_URL", "http://127.0.0.1:1")
|
t.Setenv("DINGTALK_DEVDOC_MCP_URL", "http://127.0.0.1:1")
|
||||||
path := filepath.Join(t.TempDir(), "execution.json")
|
path := filepath.Join(t.TempDir(), "execution.json")
|
||||||
if err := os.WriteFile(path, []byte(`{"attempts":{}}`), 0o600); err != nil {
|
if err := os.WriteFile(path, []byte(`{"attempts":{}}`), 0o600); err != nil {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEventStopPreviewConfirmationAndStdinCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageEventStopPreviewConfirmationAndStdinCoverage(t *testing.T) {
|
||||||
originalNormalize := eventNormalizeAs
|
originalNormalize := eventNormalizeAs
|
||||||
t.Cleanup(func() { eventNormalizeAs = originalNormalize })
|
t.Cleanup(func() { eventNormalizeAs = originalNormalize })
|
||||||
eventNormalizeAs = func(string) (string, error) { return "app", nil }
|
eventNormalizeAs = func(string) (string, error) { return "app", nil }
|
||||||
@@ -77,7 +77,7 @@ func TestEventStopPreviewConfirmationAndStdinCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunnerPluginStdioAndDryRunErrorCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRunnerPluginStdioAndDryRunErrorCoverage(t *testing.T) {
|
||||||
if _, err := (*runtimeRunner)(nil).Run(context.Background(), executor.Invocation{}); err == nil {
|
if _, err := (*runtimeRunner)(nil).Run(context.Background(), executor.Invocation{}); err == nil {
|
||||||
t.Fatal("nil runtime runner error = nil")
|
t.Fatal("nil runtime runner error = nil")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRootExecuteAllBranchesCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRootExecuteAllBranchesCoverage(t *testing.T) {
|
||||||
oldNormalize := rootNormalizeProcessProfileArgs
|
oldNormalize := rootNormalizeProcessProfileArgs
|
||||||
oldExecute := rootExecuteCommand
|
oldExecute := rootExecuteCommand
|
||||||
oldNewRoot := rootNewRootCommandWithEngine
|
oldNewRoot := rootNewRootCommandWithEngine
|
||||||
@@ -65,7 +65,7 @@ func TestRootExecuteAllBranchesCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRootConstructionHooksAndVersionCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRootConstructionHooksAndVersionCoverage(t *testing.T) {
|
||||||
oldLoadPlugins := rootLoadPlugins
|
oldLoadPlugins := rootLoadPlugins
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldVersion, oldBuild, oldCommit := version, buildTime, gitCommit
|
oldVersion, oldBuild, oldCommit := version, buildTime, gitCommit
|
||||||
@@ -120,7 +120,7 @@ func TestRootConstructionHooksAndVersionCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRootFlagsPluginsAndOutputRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRootFlagsPluginsAndOutputRemainingCoverage(t *testing.T) {
|
||||||
t.Chdir(t.TempDir())
|
t.Chdir(t.TempDir())
|
||||||
parent := &cobra.Command{Use: "root"}
|
parent := &cobra.Command{Use: "root"}
|
||||||
parent.PersistentFlags().String("format", "json", "")
|
parent.PersistentFlags().String("format", "json", "")
|
||||||
@@ -229,7 +229,7 @@ func TestRootFlagsPluginsAndOutputRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRootLoadPluginsRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRootLoadPluginsRemainingCoverage(t *testing.T) {
|
||||||
oldInject := rootPluginInjectConfigEnv
|
oldInject := rootPluginInjectConfigEnv
|
||||||
oldUser := rootPluginLoadUser
|
oldUser := rootPluginLoadUser
|
||||||
oldDev := rootPluginLoadDev
|
oldDev := rootPluginLoadDev
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func (f runnerCoverageFallback) Run(context.Context, executor.Invocation) (execu
|
|||||||
return f.result, f.err
|
return f.result, f.err
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunnerRemainingRoutingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRunnerRemainingRoutingCoverage(t *testing.T) {
|
||||||
oldResolveMulti := runnerResolveMultiProfileSelections
|
oldResolveMulti := runnerResolveMultiProfileSelections
|
||||||
oldResolveProfile := runnerResolveProfile
|
oldResolveProfile := runnerResolveProfile
|
||||||
oldCachedToken := runnerGetCachedRuntimeToken
|
oldCachedToken := runnerGetCachedRuntimeToken
|
||||||
@@ -127,7 +127,7 @@ func TestRunnerRemainingRoutingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunnerRemainingExecutionCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRunnerRemainingExecutionCoverage(t *testing.T) {
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldPreflight := runnerPreflightDocDownload
|
oldPreflight := runnerPreflightDocDownload
|
||||||
oldCall := runnerCallTool
|
oldCall := runnerCallTool
|
||||||
@@ -288,7 +288,7 @@ func TestRunnerRemainingExecutionCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunnerRemainingStdioAuthAndHeadersCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRunnerRemainingStdioAuthAndHeadersCoverage(t *testing.T) {
|
||||||
oldStdioInit := runnerStdioEnsureInitialized
|
oldStdioInit := runnerStdioEnsureInitialized
|
||||||
oldStdioCall := runnerStdioCallTool
|
oldStdioCall := runnerStdioCallTool
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func skillCoverageCommand() *cobra.Command {
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillCommandHighLevelRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillCommandHighLevelRemainingCoverage(t *testing.T) {
|
||||||
oldToken := skillLoadAccessToken
|
oldToken := skillLoadAccessToken
|
||||||
oldTmp := skillDownloadToTmp
|
oldTmp := skillDownloadToTmp
|
||||||
oldHTTP := skillHTTPDo
|
oldHTTP := skillHTTPDo
|
||||||
@@ -150,7 +150,7 @@ func TestSkillCommandHighLevelRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillCommandLowLevelRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillCommandLowLevelRemainingCoverage(t *testing.T) {
|
||||||
oldHTTP := skillHTTPDo
|
oldHTTP := skillHTTPDo
|
||||||
oldNewRequest, oldLoadToken := skillNewRequest, skillLoadTokenData
|
oldNewRequest, oldLoadToken := skillNewRequest, skillLoadTokenData
|
||||||
oldHome := skillUserHomeDir
|
oldHome := skillUserHomeDir
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func skillSetupCoverageCommand(t *testing.T, mode string, yes bool) *cobra.Comma
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillSetupHighLevelRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillSetupHighLevelRemainingCoverage(t *testing.T) {
|
||||||
oldMode := skillSetupResolveMode
|
oldMode := skillSetupResolveMode
|
||||||
oldSource := skillSetupResolveSource
|
oldSource := skillSetupResolveSource
|
||||||
oldTargets := skillSetupResolveTargets
|
oldTargets := skillSetupResolveTargets
|
||||||
@@ -120,7 +120,7 @@ func TestSkillSetupHighLevelRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkillSetupLowLevelRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSkillSetupLowLevelRemainingCoverage(t *testing.T) {
|
||||||
oldRunForm, oldInteractive := skillSetupRunForm, skillSetupInteractive
|
oldRunForm, oldInteractive := skillSetupRunForm, skillSetupInteractive
|
||||||
oldReadDir, oldStat := skillSetupReadDir, skillSetupStat
|
oldReadDir, oldStat := skillSetupReadDir, skillSetupStat
|
||||||
oldExecutable, oldGetwd, oldHome := skillSetupExecutable, skillSetupGetwd, skillSetupUserHomeDir
|
oldExecutable, oldGetwd, oldHome := skillSetupExecutable, skillSetupGetwd, skillSetupUserHomeDir
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func (i upgradeFileInfo) ModTime() time.Time { return time.Time{} }
|
|||||||
func (i upgradeFileInfo) IsDir() bool { return false }
|
func (i upgradeFileInfo) IsDir() bool { return false }
|
||||||
func (i upgradeFileInfo) Sys() any { return nil }
|
func (i upgradeFileInfo) Sys() any { return nil }
|
||||||
|
|
||||||
func TestUpgradeRollbackAndCommandBranchesCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageUpgradeRollbackAndCommandBranchesCoverage(t *testing.T) {
|
||||||
oldClient, oldRollback := newUpgradeReleaseClient, newUpgradeRollback
|
oldClient, oldRollback := newUpgradeReleaseClient, newUpgradeRollback
|
||||||
oldEdition := edition.Get()
|
oldEdition := edition.Get()
|
||||||
oldStdin := os.Stdin
|
oldStdin := os.Stdin
|
||||||
@@ -150,7 +150,7 @@ func TestUpgradeRollbackAndCommandBranchesCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunUpgradeAllStagesCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRunUpgradeAllStagesCoverage(t *testing.T) {
|
||||||
oldClient, oldRollback := newUpgradeReleaseClient, newUpgradeRollback
|
oldClient, oldRollback := newUpgradeReleaseClient, newUpgradeRollback
|
||||||
oldEnsure, oldCleanup := ensureUpgradeDirs, cleanupUpgradeStale
|
oldEnsure, oldCleanup := ensureUpgradeDirs, cleanupUpgradeStale
|
||||||
oldNeeds, oldBinary, oldSkills, oldChecksums := upgradeNeedsUpgrade, findUpgradeBinary, findUpgradeSkills, findUpgradeChecksums
|
oldNeeds, oldBinary, oldSkills, oldChecksums := upgradeNeedsUpgrade, findUpgradeBinary, findUpgradeSkills, findUpgradeChecksums
|
||||||
@@ -355,7 +355,7 @@ func TestRunUpgradeAllStagesCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUpgradeBinaryHelpersFailureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageUpgradeBinaryHelpersFailureCoverage(t *testing.T) {
|
||||||
oldStat, oldChmod := upgradeStat, upgradeChmod
|
oldStat, oldChmod := upgradeStat, upgradeChmod
|
||||||
oldTry, oldRepair := upgradeTryExecVersion, upgradeRepairDarwin
|
oldTry, oldRepair := upgradeTryExecVersion, upgradeRepairDarwin
|
||||||
oldGOOS := upgradeRuntimeGOOS
|
oldGOOS := upgradeRuntimeGOOS
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChainErrorAndLargeRecordCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageChainErrorAndLargeRecordCoverage(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
closed, err := os.Create(filepath.Join(dir, "closed"))
|
closed, err := os.Create(filepath.Join(dir, "closed"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -86,7 +86,7 @@ func TestChainErrorAndLargeRecordCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectionAndRotationCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCollectionAndRotationCoverage(t *testing.T) {
|
||||||
for _, value := range []string{"1", "true", "on", "yes", "y"} {
|
for _, value := range []string{"1", "true", "on", "yes", "y"} {
|
||||||
t.Setenv(EnvAuditDebug, value)
|
t.Setenv(EnvAuditDebug, value)
|
||||||
if !DebugEnabled() {
|
if !DebugEnabled() {
|
||||||
@@ -264,7 +264,7 @@ func TestCollectionAndRotationCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSinkAndForwarderFailureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSinkAndForwarderFailureCoverage(t *testing.T) {
|
||||||
originalMarshal, originalWrite := sinkMarshal, sinkWrite
|
originalMarshal, originalWrite := sinkMarshal, sinkWrite
|
||||||
originalForwardMarshal, originalRedact := forwardMarshal, forwardRedactEventJSON
|
originalForwardMarshal, originalRedact := forwardMarshal, forwardRedactEventJSON
|
||||||
originalReadAt, originalSeek, originalChainMarshal := chainReadAt, chainSeek, chainMarshal
|
originalReadAt, originalSeek, originalChainMarshal := chainReadAt, chainSeek, chainMarshal
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUnixBrowserCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageUnixBrowserCoverageEdges(t *testing.T) {
|
||||||
oldStart := browserStartCommand
|
oldStart := browserStartCommand
|
||||||
t.Cleanup(func() { browserStartCommand = oldStart })
|
t.Cleanup(func() { browserStartCommand = oldStart })
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ func (f *fakePortableTemp) Chmod(os.FileMode) error { return f.chmodErr }
|
|||||||
func (f *fakePortableTemp) Sync() error { return f.syncErr }
|
func (f *fakePortableTemp) Sync() error { return f.syncErr }
|
||||||
func (f *fakePortableTemp) Close() error { f.closeCall++; return f.closeErr }
|
func (f *fakePortableTemp) Close() error { f.closeCall++; return f.closeErr }
|
||||||
|
|
||||||
func TestAppTokenEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAppTokenEdges(t *testing.T) {
|
||||||
if err := SaveAppTokenData(&AppTokenData{}); err == nil {
|
if err := SaveAppTokenData(&AppTokenData{}); err == nil {
|
||||||
t.Fatal("empty client ID save succeeded")
|
t.Fatal("empty client ID save succeeded")
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ func TestAppTokenEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeviceFlowRequestAndOutputEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDeviceFlowRequestAndOutputEdges(t *testing.T) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
p := &DeviceFlowProvider{Output: &buf, clientID: "client", scope: "scope", httpClient: http.DefaultClient}
|
p := &DeviceFlowProvider{Output: &buf, clientID: "client", scope: "scope", httpClient: http.DefaultClient}
|
||||||
p.SetScope("custom")
|
p.SetScope("custom")
|
||||||
@@ -334,7 +334,7 @@ func TestDeviceFlowRequestAndOutputEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeviceFlowWaitImmediateEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDeviceFlowWaitImmediateEdges(t *testing.T) {
|
||||||
p := &DeviceFlowProvider{Output: io.Discard}
|
p := &DeviceFlowProvider{Output: io.Discard}
|
||||||
if _, err := p.waitForAuthorizationByFlowID(context.Background(), &DeviceAuthResponse{ExpiresIn: 0}); err == nil {
|
if _, err := p.waitForAuthorizationByFlowID(context.Background(), &DeviceAuthResponse{ExpiresIn: 0}); err == nil {
|
||||||
t.Fatal("flow deadline succeeded")
|
t.Fatal("flow deadline succeeded")
|
||||||
@@ -357,7 +357,7 @@ func TestDeviceFlowWaitImmediateEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeviceFlowLoginRetry(t *testing.T) {
|
func TestCrossPlatformCoverageDeviceFlowLoginRetry(t *testing.T) {
|
||||||
oldClient := oauthHTTPClient
|
oldClient := oauthHTTPClient
|
||||||
oldAfter := deviceFlowAfter
|
oldAfter := deviceFlowAfter
|
||||||
oldBrowser := deviceOpenBrowser
|
oldBrowser := deviceOpenBrowser
|
||||||
@@ -418,7 +418,7 @@ func TestDeviceFlowLoginRetry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPortablePathHelpers(t *testing.T) {
|
func TestCrossPlatformCoveragePortablePathHelpers(t *testing.T) {
|
||||||
if _, err := cleanPortableName("../escape"); err == nil {
|
if _, err := cleanPortableName("../escape"); err == nil {
|
||||||
t.Fatal("unsafe portable name succeeded")
|
t.Fatal("unsafe portable name succeeded")
|
||||||
}
|
}
|
||||||
@@ -461,7 +461,7 @@ func TestPortablePathHelpers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProfilesLifecycleEdges(t *testing.T) {
|
func TestCrossPlatformCoverageProfilesLifecycleEdges(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
cfg, err := LoadProfiles(dir)
|
cfg, err := LoadProfiles(dir)
|
||||||
if err != nil || cfg.Version != 1 || len(cfg.Profiles) != 0 {
|
if err != nil || cfg.Version != 1 || len(cfg.Profiles) != 0 {
|
||||||
@@ -595,7 +595,7 @@ func TestProfilesLifecycleEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProfilesMigrationAndMirror(t *testing.T) {
|
func TestCrossPlatformCoverageProfilesMigrationAndMirror(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
_ = DeleteTokenDataKeychain()
|
_ = DeleteTokenDataKeychain()
|
||||||
legacy := &TokenData{CorpID: "legacy-corp", CorpName: "Legacy", AccessToken: "token"}
|
legacy := &TokenData{CorpID: "legacy-corp", CorpName: "Legacy", AccessToken: "token"}
|
||||||
@@ -632,7 +632,7 @@ func TestProfilesMigrationAndMirror(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTokenEditionHooksAndCleanup(t *testing.T) {
|
func TestCrossPlatformCoverageTokenEditionHooksAndCleanup(t *testing.T) {
|
||||||
oldHooks := edition.Get()
|
oldHooks := edition.Get()
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
edition.Override(oldHooks)
|
edition.Override(oldHooks)
|
||||||
@@ -678,7 +678,7 @@ func TestTokenEditionHooksAndCleanup(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTokenAndKeychainEdges(t *testing.T) {
|
func TestCrossPlatformCoverageTokenAndKeychainEdges(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
if err := SaveTokenDataKeychainForCorpID("", &TokenData{}); err == nil {
|
if err := SaveTokenDataKeychainForCorpID("", &TokenData{}); err == nil {
|
||||||
t.Fatal("empty corp token save succeeded")
|
t.Fatal("empty corp token save succeeded")
|
||||||
@@ -742,7 +742,7 @@ func TestTokenAndKeychainEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAppConfigDeleteReloadEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAppConfigDeleteReloadEdges(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
if err := os.Mkdir(GetAppConfigPath(dir), 0o755); err != nil {
|
if err := os.Mkdir(GetAppConfigPath(dir), 0o755); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -780,7 +780,7 @@ func TestAppConfigDeleteReloadEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBasicAuthCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageBasicAuthCoverageEdges(t *testing.T) {
|
||||||
t.Run("channel and status", func(t *testing.T) {
|
t.Run("channel and status", func(t *testing.T) {
|
||||||
t.Setenv(AgentCodeEnv, " agent ")
|
t.Setenv(AgentCodeEnv, " agent ")
|
||||||
if !AgentCodeEnvPresent() || !HostOwnsPATFlow() {
|
if !AgentCodeEnvPresent() || !HostOwnsPATFlow() {
|
||||||
@@ -1054,7 +1054,7 @@ func TestBasicAuthCoverageEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPortableAuthBundleCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoveragePortableAuthBundleCoverageEdges(t *testing.T) {
|
||||||
makeBundle := func(t *testing.T, entries []tar.Header, bodies []string) []byte {
|
makeBundle := func(t *testing.T, entries []tar.Header, bodies []string) []byte {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
@@ -1439,7 +1439,7 @@ func TestPortableAuthBundleCoverageEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTokenStorageAndRevocationCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageTokenStorageAndRevocationCoverageEdges(t *testing.T) {
|
||||||
oldMarshalIndent := tokenJSONMarshalIndent
|
oldMarshalIndent := tokenJSONMarshalIndent
|
||||||
oldMarshal := tokenJSONMarshal
|
oldMarshal := tokenJSONMarshal
|
||||||
oldMkdir := tokenMkdirAll
|
oldMkdir := tokenMkdirAll
|
||||||
@@ -1826,7 +1826,7 @@ func TestTokenStorageAndRevocationCoverageEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSmallRemainingAuthEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSmallRemainingAuthEdges(t *testing.T) {
|
||||||
t.Run("app token hooks", func(t *testing.T) {
|
t.Run("app token hooks", func(t *testing.T) {
|
||||||
oldIndent := appTokenMarshalIndent
|
oldIndent := appTokenMarshalIndent
|
||||||
oldMarshal := appTokenMarshal
|
oldMarshal := appTokenMarshal
|
||||||
@@ -2025,7 +2025,7 @@ func TestSmallRemainingAuthEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProfilesCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageProfilesCoverageEdges(t *testing.T) {
|
||||||
oldAcquire := profilesAcquireDualLock
|
oldAcquire := profilesAcquireDualLock
|
||||||
oldRead := profilesReadFile
|
oldRead := profilesReadFile
|
||||||
oldRename := profilesRename
|
oldRename := profilesRename
|
||||||
@@ -2270,7 +2270,7 @@ func TestProfilesCoverageEdges(t *testing.T) {
|
|||||||
normalizeProfilesConfig(nil)
|
normalizeProfilesConfig(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSecureIdentityKeychainAndLockEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSecureIdentityKeychainAndLockEdges(t *testing.T) {
|
||||||
t.Run("secure store", func(t *testing.T) {
|
t.Run("secure store", func(t *testing.T) {
|
||||||
oldGetMAC := secureGetMAC
|
oldGetMAC := secureGetMAC
|
||||||
oldMkdir := secureMkdirAll
|
oldMkdir := secureMkdirAll
|
||||||
@@ -2582,7 +2582,7 @@ func TestSecureIdentityKeychainAndLockEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAppConfigHookCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAppConfigHookCoverageEdges(t *testing.T) {
|
||||||
oldStore := appConfigStoreSecret
|
oldStore := appConfigStoreSecret
|
||||||
oldMarshal := appConfigMarshalIndent
|
oldMarshal := appConfigMarshalIndent
|
||||||
oldWrite := appConfigAtomicWrite
|
oldWrite := appConfigAtomicWrite
|
||||||
@@ -2678,7 +2678,7 @@ func TestAppConfigHookCoverageEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeviceFlowHighLevelCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDeviceFlowHighLevelCoverageEdges(t *testing.T) {
|
||||||
oldFetch := deviceFetchClientID
|
oldFetch := deviceFetchClientID
|
||||||
oldLogin := deviceLoginOnce
|
oldLogin := deviceLoginOnce
|
||||||
oldRequest := deviceRequestCode
|
oldRequest := deviceRequestCode
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ func httpGetBody(t *testing.T, rawURL string) (int, string) {
|
|||||||
return resp.StatusCode, string(data)
|
return resp.StatusCode, string(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthLoginCallbackAndAPIs(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthLoginCallbackAndAPIs(t *testing.T) {
|
||||||
f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus {
|
f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus {
|
||||||
return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}}
|
return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}}
|
||||||
})
|
})
|
||||||
@@ -224,7 +224,7 @@ func TestOAuthLoginCallbackAndAPIs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthLoginMissingCallbackCode(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthLoginMissingCallbackCode(t *testing.T) {
|
||||||
f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus {
|
f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus {
|
||||||
return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}}
|
return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}}
|
||||||
})
|
})
|
||||||
@@ -244,7 +244,7 @@ func TestOAuthLoginMissingCallbackCode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthLoginEarlyAndListenerEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthLoginEarlyAndListenerEdges(t *testing.T) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
p := &OAuthProvider{configDir: t.TempDir(), Output: &buf}
|
p := &OAuthProvider{configDir: t.TempDir(), Output: &buf}
|
||||||
if p.output() != &buf || (*OAuthProvider)(nil).output() != io.Discard {
|
if p.output() != &buf || (*OAuthProvider)(nil).output() != io.Discard {
|
||||||
@@ -279,7 +279,7 @@ func TestOAuthLoginEarlyAndListenerEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthLoginTimeoutAndServerError(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthLoginTimeoutAndServerError(t *testing.T) {
|
||||||
oldTimeout := oauthLoginTimeout
|
oldTimeout := oauthLoginTimeout
|
||||||
oldListen := oauthListen
|
oldListen := oauthListen
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -310,7 +310,7 @@ func TestOAuthLoginTimeoutAndServerError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthProviderOtherMethods(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthProviderOtherMethods(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
_ = DeleteTokenDataKeychain()
|
_ = DeleteTokenDataKeychain()
|
||||||
t.Cleanup(func() { _ = DeleteTokenDataKeychain() })
|
t.Cleanup(func() { _ = DeleteTokenDataKeychain() })
|
||||||
@@ -362,7 +362,7 @@ func (f roundTripFunc) RoundTrip(r *http.Request) (*http.Response, error) {
|
|||||||
return f(r)
|
return f(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthPersistConfigEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthPersistConfigEdges(t *testing.T) {
|
||||||
p := &OAuthProvider{configDir: t.TempDir(), logger: slog.Default()}
|
p := &OAuthProvider{configDir: t.TempDir(), logger: slog.Default()}
|
||||||
SetClientID("")
|
SetClientID("")
|
||||||
SetClientSecret("")
|
SetClientSecret("")
|
||||||
@@ -387,7 +387,7 @@ func TestOAuthPersistConfigEdges(t *testing.T) {
|
|||||||
SetClientSecret("")
|
SetClientSecret("")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildOAuthAuthURLTarget(t *testing.T) {
|
func TestCrossPlatformCoverageBuildOAuthAuthURLTarget(t *testing.T) {
|
||||||
raw := buildAuthURL("client", "http://localhost/callback", "corp")
|
raw := buildAuthURL("client", "http://localhost/callback", "corp")
|
||||||
parsed, err := url.Parse(raw)
|
parsed, err := url.Parse(raw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -398,7 +398,7 @@ func TestBuildOAuthAuthURLTarget(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthLoginDenialAndPolling(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthLoginDenialAndPolling(t *testing.T) {
|
||||||
oldPoll := oauthPollInterval
|
oldPoll := oauthPollInterval
|
||||||
oldApproval := oauthApprovalTimeout
|
oldApproval := oauthApprovalTimeout
|
||||||
oldPause := oauthSuccessPause
|
oldPause := oauthSuccessPause
|
||||||
@@ -514,7 +514,7 @@ func TestOAuthLoginDenialAndPolling(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthLoginExchangeFailure(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthLoginExchangeFailure(t *testing.T) {
|
||||||
f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus {
|
f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus {
|
||||||
return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}}
|
return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}}
|
||||||
})
|
})
|
||||||
@@ -535,7 +535,7 @@ func TestOAuthLoginExchangeFailure(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthRefreshAndParsingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthRefreshAndParsingEdges(t *testing.T) {
|
||||||
t.Setenv("DWS_CLIENT_ID", "")
|
t.Setenv("DWS_CLIENT_ID", "")
|
||||||
t.Setenv("DWS_CLIENT_SECRET", "")
|
t.Setenv("DWS_CLIENT_SECRET", "")
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
@@ -639,7 +639,7 @@ func TestOAuthRefreshAndParsingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthProviderHighLevelEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthProviderHighLevelEdges(t *testing.T) {
|
||||||
oldLoad := oauthLoadToken
|
oldLoad := oauthLoadToken
|
||||||
oldAcquire := oauthAcquireLock
|
oldAcquire := oauthAcquireLock
|
||||||
oldMark := oauthMarkProfile
|
oldMark := oauthMarkProfile
|
||||||
@@ -769,7 +769,7 @@ func TestOAuthProviderHighLevelEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthCallbackRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthCallbackRemainingEdges(t *testing.T) {
|
||||||
oldCheck := oauthCheckStatus
|
oldCheck := oauthCheckStatus
|
||||||
oldAdmins := oauthGetAdmins
|
oldAdmins := oauthGetAdmins
|
||||||
oldApply := oauthSendApply
|
oldApply := oauthSendApply
|
||||||
@@ -936,7 +936,7 @@ func TestOAuthCallbackRemainingEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOAuthHelperRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOAuthHelperRemainingEdges(t *testing.T) {
|
||||||
oldClient := oauthHTTPClient
|
oldClient := oauthHTTPClient
|
||||||
oldRequest := oauthNewRequest
|
oldRequest := oauthNewRequest
|
||||||
oldRetry := oauthRetryAfter
|
oldRetry := oauthRetryAfter
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition"
|
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMigrateKeychainToFileDEKCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageMigrateKeychainToFileDEKCoverage(t *testing.T) {
|
||||||
orig := authMigrateToFileDEK
|
orig := authMigrateToFileDEK
|
||||||
t.Cleanup(func() { authMigrateToFileDEK = orig })
|
t.Cleanup(func() { authMigrateToFileDEK = orig })
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ func TestMigrateKeychainToFileDEKCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTokenPersistencePreflightRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageTokenPersistencePreflightRemainingEdges(t *testing.T) {
|
||||||
origHooks := edition.Get()
|
origHooks := edition.Get()
|
||||||
origGet := authKeychainGet
|
origGet := authKeychainGet
|
||||||
origValidate := authValidateEntries
|
origValidate := authValidateEntries
|
||||||
@@ -90,7 +90,7 @@ func TestTokenPersistencePreflightRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPortableExportRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoveragePortableExportRemainingEdges(t *testing.T) {
|
||||||
origStat := portableStat
|
origStat := portableStat
|
||||||
origConfigFiles := portableConfigFilesForExport
|
origConfigFiles := portableConfigFilesForExport
|
||||||
origManifest := portableWriteManifest
|
origManifest := portableWriteManifest
|
||||||
@@ -167,7 +167,7 @@ func TestPortableExportRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadTokenDataForProfileLegacyFailure(t *testing.T) {
|
func TestCrossPlatformCoverageLoadTokenDataForProfileLegacyFailure(t *testing.T) {
|
||||||
origResolve := tokenResolveProfile
|
origResolve := tokenResolveProfile
|
||||||
origLoadCorp := tokenLoadKeychainForCorpID
|
origLoadCorp := tokenLoadKeychainForCorpID
|
||||||
origLoadLegacy := tokenLoadKeychain
|
origLoadLegacy := tokenLoadKeychain
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRuntimeAnnotationAPIsCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeAnnotationAPIsCoverage(t *testing.T) {
|
||||||
AttachRuntimeSchema(nil, "p", "t", "s")
|
AttachRuntimeSchema(nil, "p", "t", "s")
|
||||||
AttachRuntimeSchema(&cobra.Command{}, "", "", "")
|
AttachRuntimeSchema(&cobra.Command{}, "", "", "")
|
||||||
AnnotateRuntimeToolMetadata(nil, "", "", "")
|
AnnotateRuntimeToolMetadata(nil, "", "", "")
|
||||||
@@ -60,7 +60,7 @@ func TestRuntimeAnnotationAPIsCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeRegistriesAndSchemaHintsCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeRegistriesAndSchemaHintsCoverage(t *testing.T) {
|
||||||
originalConstraints := runtimeSchemaConstraintsByCanonical
|
originalConstraints := runtimeSchemaConstraintsByCanonical
|
||||||
originalParameters := runtimeSchemaParameterMetadataByCanonical
|
originalParameters := runtimeSchemaParameterMetadataByCanonical
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition"
|
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCanonicalCommandsAndFlags(t *testing.T) {
|
func TestCrossPlatformCoverageCanonicalCommandsAndFlags(t *testing.T) {
|
||||||
mcp := NewMCPCommand(t.Context(), nil, nil, nil)
|
mcp := NewMCPCommand(t.Context(), nil, nil, nil)
|
||||||
mcp.SetOut(&bytes.Buffer{})
|
mcp.SetOut(&bytes.Buffer{})
|
||||||
if err := mcp.Execute(); err != nil {
|
if err := mcp.Execute(); err != nil {
|
||||||
@@ -84,7 +84,7 @@ func TestCanonicalCommandsAndFlags(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoaderAndPriorityEdges(t *testing.T) {
|
func TestCrossPlatformCoverageLoaderAndPriorityEdges(t *testing.T) {
|
||||||
for _, reason := range []CatalogDegradedReason{DegradedUnauthenticated, DegradedMarketUnreachable, DegradedRuntimeAllFailed, "other"} {
|
for _, reason := range []CatalogDegradedReason{DegradedUnauthenticated, DegradedMarketUnreachable, DegradedRuntimeAllFailed, "other"} {
|
||||||
degraded := newCatalogDegraded(reason, 2)
|
degraded := newCatalogDegraded(reason, 2)
|
||||||
if degraded.Error() == "" || degradedHint(reason, 2) == "" || degraded.Hint == "" {
|
if degraded.Error() == "" || degradedHint(reason, 2) == "" || degraded.Hint == "" {
|
||||||
@@ -131,7 +131,7 @@ func TestLoaderAndPriorityEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaValidationCompleteMatrix(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaValidationCompleteMatrix(t *testing.T) {
|
||||||
if err := ValidateInputSchema(nil, nil); err != nil {
|
if err := ValidateInputSchema(nil, nil); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ func TestSchemaValidationCompleteMatrix(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStdinCompleteMatrix(t *testing.T) {
|
func TestCrossPlatformCoverageStdinCompleteMatrix(t *testing.T) {
|
||||||
original := os.Stdin
|
original := os.Stdin
|
||||||
t.Cleanup(func() { os.Stdin = original })
|
t.Cleanup(func() { os.Stdin = original })
|
||||||
closed, err := os.CreateTemp(t.TempDir(), "closed")
|
closed, err := os.CreateTemp(t.TempDir(), "closed")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRuntimeSchemaLoaderAndAnnotationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeSchemaLoaderAndAnnotationEdges(t *testing.T) {
|
||||||
originalJSON := embeddedMCPMetadataJSON
|
originalJSON := embeddedMCPMetadataJSON
|
||||||
t.Cleanup(func() { embeddedMCPMetadataJSON = originalJSON })
|
t.Cleanup(func() { embeddedMCPMetadataJSON = originalJSON })
|
||||||
embeddedMCPMetadataJSON = []byte("{")
|
embeddedMCPMetadataJSON = []byte("{")
|
||||||
@@ -45,7 +45,7 @@ func TestRuntimeSchemaLoaderAndAnnotationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectRuntimeSchemaEntriesErrorsAndOrdering(t *testing.T) {
|
func TestCrossPlatformCoverageCollectRuntimeSchemaEntriesErrorsAndOrdering(t *testing.T) {
|
||||||
originalValidate := validateReviewedParameterBindings
|
originalValidate := validateReviewedParameterBindings
|
||||||
originalRegistry := loadReviewedCommandRegistry
|
originalRegistry := loadReviewedCommandRegistry
|
||||||
originalManual := loadReviewedManualSchemaHints
|
originalManual := loadReviewedManualSchemaHints
|
||||||
@@ -89,7 +89,7 @@ func TestCollectRuntimeSchemaEntriesErrorsAndOrdering(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeSchemaMetadataLookupEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeSchemaMetadataLookupEdges(t *testing.T) {
|
||||||
originalHints := defaultSchemaHintRegistry
|
originalHints := defaultSchemaHintRegistry
|
||||||
t.Cleanup(func() { defaultSchemaHintRegistry = originalHints })
|
t.Cleanup(func() { defaultSchemaHintRegistry = originalHints })
|
||||||
defaultSchemaHintRegistry = newSchemaHintRegistry()
|
defaultSchemaHintRegistry = newSchemaHintRegistry()
|
||||||
@@ -142,7 +142,7 @@ func TestRuntimeSchemaMetadataLookupEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeSchemaCandidateAndProvenanceEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeSchemaCandidateAndProvenanceEdges(t *testing.T) {
|
||||||
left := runtimeSchemaStringCandidateAtPriority("same", true, "same", 1, "z")
|
left := runtimeSchemaStringCandidateAtPriority("same", true, "same", 1, "z")
|
||||||
right := runtimeSchemaStringCandidateAtPriority("same", true, "same", 1, "a")
|
right := runtimeSchemaStringCandidateAtPriority("same", true, "same", 1, "a")
|
||||||
winner, err := resolveRuntimeSchemaCandidate("ordering", left, right)
|
winner, err := resolveRuntimeSchemaCandidate("ordering", left, right)
|
||||||
@@ -180,7 +180,7 @@ func TestRuntimeSchemaCandidateAndProvenanceEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeCommandParameterErrorEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeCommandParameterErrorEdges(t *testing.T) {
|
||||||
cmd := &cobra.Command{Use: "run"}
|
cmd := &cobra.Command{Use: "run"}
|
||||||
cmd.Flags().String("value", "", "value")
|
cmd.Flags().String("value", "", "value")
|
||||||
flag := cmd.Flags().Lookup("value")
|
flag := cmd.Flags().Lookup("value")
|
||||||
@@ -269,7 +269,7 @@ func TestRuntimeCommandParameterErrorEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeSchemaPureHelperEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeSchemaPureHelperEdges(t *testing.T) {
|
||||||
if runtimeCommandFlag(nil, "x") != nil || runtimeCommandFlag(&cobra.Command{Use: "run"}, " ") != nil {
|
if runtimeCommandFlag(nil, "x") != nil || runtimeCommandFlag(&cobra.Command{Use: "run"}, " ") != nil {
|
||||||
t.Fatal("invalid command flag lookup should be nil")
|
t.Fatal("invalid command flag lookup should be nil")
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ func TestRuntimeSchemaPureHelperEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaCompactProjectionEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaCompactProjectionEdges(t *testing.T) {
|
||||||
if stripSchemaPayloadCompact(nil) != nil {
|
if stripSchemaPayloadCompact(nil) != nil {
|
||||||
t.Fatal("nil compact payload should stay nil")
|
t.Fatal("nil compact payload should stay nil")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuildSchemaCatalogSnapshotGateFailures(t *testing.T) {
|
func TestCrossPlatformCoverageBuildSchemaCatalogSnapshotGateFailures(t *testing.T) {
|
||||||
registry, _ := validSnapshotAdapterFixture(t)
|
registry, _ := validSnapshotAdapterFixture(t)
|
||||||
resolved := ResolvedSchemaBuild{root: &cobra.Command{Use: "root"}, registry: registry}
|
resolved := ResolvedSchemaBuild{root: &cobra.Command{Use: "root"}, registry: registry}
|
||||||
original := captureCatalogHooks()
|
original := captureCatalogHooks()
|
||||||
@@ -70,7 +70,7 @@ func TestBuildSchemaCatalogSnapshotGateFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadSchemaCatalogSnapshotGateFailures(t *testing.T) {
|
func TestCrossPlatformCoverageLoadSchemaCatalogSnapshotGateFailures(t *testing.T) {
|
||||||
_, base := validSnapshotAdapterFixture(t)
|
_, base := validSnapshotAdapterFixture(t)
|
||||||
base.Version = SchemaCatalogSnapshotVersion
|
base.Version = SchemaCatalogSnapshotVersion
|
||||||
base.SourceHash = schemaCatalogSnapshotHash(base)
|
base.SourceHash = schemaCatalogSnapshotHash(base)
|
||||||
@@ -120,7 +120,7 @@ func TestLoadSchemaCatalogSnapshotGateFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaCatalogLookupAndConversionEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaCatalogLookupAndConversionEdges(t *testing.T) {
|
||||||
if exactSchemaCommand(nil, "sample") != nil {
|
if exactSchemaCommand(nil, "sample") != nil {
|
||||||
t.Fatal("nil root resolved a command")
|
t.Fatal("nil root resolved a command")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ func requirePanicCoverage(t *testing.T, fn func()) {
|
|||||||
fn()
|
fn()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeCompatibilityAnnotationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeCompatibilityAnnotationEdges(t *testing.T) {
|
||||||
valid := RuntimeCompatibilityEquivalence{ID: "pair", Reason: "reviewed", Reviewed: true}
|
valid := RuntimeCompatibilityEquivalence{ID: "pair", Reason: "reviewed", Reviewed: true}
|
||||||
requirePanicCoverage(t, func() { AnnotateRuntimeCompatibilityEquivalence(nil, &cobra.Command{}, valid) })
|
requirePanicCoverage(t, func() { AnnotateRuntimeCompatibilityEquivalence(nil, &cobra.Command{}, valid) })
|
||||||
requirePanicCoverage(t, func() {
|
requirePanicCoverage(t, func() {
|
||||||
@@ -55,7 +55,7 @@ func TestRuntimeCompatibilityAnnotationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBindEffectiveCommandRegistryWrapperEdges(t *testing.T) {
|
func TestCrossPlatformCoverageBindEffectiveCommandRegistryWrapperEdges(t *testing.T) {
|
||||||
oldValidate := bindValidateParameterBindings
|
oldValidate := bindValidateParameterBindings
|
||||||
t.Cleanup(func() { bindValidateParameterBindings = oldValidate })
|
t.Cleanup(func() { bindValidateParameterBindings = oldValidate })
|
||||||
if _, err := BindEffectiveCommandRegistry(nil, EffectiveCommandRegistry{}); err == nil || !strings.Contains(err.Error(), "root is nil") {
|
if _, err := BindEffectiveCommandRegistry(nil, EffectiveCommandRegistry{}); err == nil || !strings.Contains(err.Error(), "root is nil") {
|
||||||
@@ -71,7 +71,7 @@ func TestBindEffectiveCommandRegistryWrapperEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommandRegistryAliasBindingRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCommandRegistryAliasBindingRemainingEdges(t *testing.T) {
|
||||||
spec := CommandSpec{CanonicalPath: "sample.run", PrimaryCLIPath: "sample run"}
|
spec := CommandSpec{CanonicalPath: "sample.run", PrimaryCLIPath: "sample run"}
|
||||||
root := commandRegistryTestRoot("sample run", "sample group")
|
root := commandRegistryTestRoot("sample run", "sample group")
|
||||||
primary := exactSchemaCommand(root, "sample run")
|
primary := exactSchemaCommand(root, "sample run")
|
||||||
@@ -97,7 +97,7 @@ func TestCommandRegistryAliasBindingRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompatibilityLeafContractDependencyAndMetadataEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCompatibilityLeafContractDependencyAndMetadataEdges(t *testing.T) {
|
||||||
oldContracts := loadCompatibilityFlagContracts
|
oldContracts := loadCompatibilityFlagContracts
|
||||||
oldBindings := compatibilityParameterBindings
|
oldBindings := compatibilityParameterBindings
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -185,7 +185,7 @@ func TestCompatibilityLeafContractDependencyAndMetadataEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompatibilityFlagContractDifferenceEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCompatibilityFlagContractDifferenceEdges(t *testing.T) {
|
||||||
oldContracts := loadCompatibilityFlagContracts
|
oldContracts := loadCompatibilityFlagContracts
|
||||||
t.Cleanup(func() { loadCompatibilityFlagContracts = oldContracts })
|
t.Cleanup(func() { loadCompatibilityFlagContracts = oldContracts })
|
||||||
primaryContracts := map[string]compatibilityFlagContract{
|
primaryContracts := map[string]compatibilityFlagContract{
|
||||||
@@ -216,7 +216,7 @@ func TestCompatibilityFlagContractDifferenceEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompatibilityHandlerAndArgsRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCompatibilityHandlerAndArgsRemainingEdges(t *testing.T) {
|
||||||
if problems := compatibilityHandlerContractProblems(nil, &cobra.Command{}); len(problems) != 1 {
|
if problems := compatibilityHandlerContractProblems(nil, &cobra.Command{}); len(problems) != 1 {
|
||||||
t.Fatalf("nil handler problems = %v", problems)
|
t.Fatalf("nil handler problems = %v", problems)
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ func TestCompatibilityHandlerAndArgsRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompatibilityPathAndHelperRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCompatibilityPathAndHelperRemainingEdges(t *testing.T) {
|
||||||
if got := compatibilityJSON(func() {}); !strings.Contains(got, "0x") {
|
if got := compatibilityJSON(func() {}); !strings.Contains(got, "0x") {
|
||||||
t.Fatalf("compatibilityJSON(func) = %q", got)
|
t.Fatalf("compatibilityJSON(func) = %q", got)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEmbeddedRuntimeSchemaExclusionDecodeEdges(t *testing.T) {
|
func TestCrossPlatformCoverageEmbeddedRuntimeSchemaExclusionDecodeEdges(t *testing.T) {
|
||||||
previous := embeddedRuntimeSchemaExclusionsJSON
|
previous := embeddedRuntimeSchemaExclusionsJSON
|
||||||
t.Cleanup(func() { embeddedRuntimeSchemaExclusionsJSON = previous })
|
t.Cleanup(func() { embeddedRuntimeSchemaExclusionsJSON = previous })
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
@@ -32,7 +32,7 @@ func TestEmbeddedRuntimeSchemaExclusionDecodeEdges(t *testing.T) {
|
|||||||
embeddedRuntimeSchemaExclusionsJSON = previous
|
embeddedRuntimeSchemaExclusionsJSON = previous
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompletenessWrapperErrorBoundaries(t *testing.T) {
|
func TestCrossPlatformCoverageCompletenessWrapperErrorBoundaries(t *testing.T) {
|
||||||
oldLoad := completenessLoadExclusions
|
oldLoad := completenessLoadExclusions
|
||||||
oldApply := completenessApplyManual
|
oldApply := completenessApplyManual
|
||||||
oldBuild := completenessBuildEffective
|
oldBuild := completenessBuildEffective
|
||||||
@@ -124,7 +124,7 @@ func TestCompletenessWrapperErrorBoundaries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCatalogDeliveryCompletenessLoadedIdentityEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCatalogDeliveryCompletenessLoadedIdentityEdges(t *testing.T) {
|
||||||
oldQuery := deliverySchemaPayload
|
oldQuery := deliverySchemaPayload
|
||||||
oldResolve := deliveryIndexResolve
|
oldResolve := deliveryIndexResolve
|
||||||
oldTool := deliveryToolPayload
|
oldTool := deliveryToolPayload
|
||||||
@@ -283,7 +283,7 @@ func TestCatalogDeliveryCompletenessLoadedIdentityEdges(t *testing.T) {
|
|||||||
schemaCatalogDeliveryCompletenessAgainstLoadedAndIdentity(root, loaded, nil, identities, nil)
|
schemaCatalogDeliveryCompletenessAgainstLoadedAndIdentity(root, loaded, nil, identities, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaRegistryProjectionRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaRegistryProjectionRemainingEdges(t *testing.T) {
|
||||||
oldRegistry := deliveryRegistryPayload
|
oldRegistry := deliveryRegistryPayload
|
||||||
oldProduct := renderRegistryProductSummary
|
oldProduct := renderRegistryProductSummary
|
||||||
oldQuery := deliverySchemaPayload
|
oldQuery := deliverySchemaPayload
|
||||||
@@ -400,7 +400,7 @@ func TestSchemaRegistryProjectionRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompletenessIdentityAndPathHelpersRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCompletenessIdentityAndPathHelpersRemainingEdges(t *testing.T) {
|
||||||
bound := BoundCommandRegistry{Commands: []BoundCommandSpec{
|
bound := BoundCommandRegistry{Commands: []BoundCommandSpec{
|
||||||
{CommandSpec: CommandSpec{CanonicalPath: "sample.one", PrimaryCLIPath: "sample run", Visibility: SchemaVisibilityPublic}},
|
{CommandSpec: CommandSpec{CanonicalPath: "sample.one", PrimaryCLIPath: "sample run", Visibility: SchemaVisibilityPublic}},
|
||||||
{CommandSpec: CommandSpec{CanonicalPath: "sample.two", PrimaryCLIPath: "sample run", Visibility: SchemaVisibilityPublic}},
|
{CommandSpec: CommandSpec{CanonicalPath: "sample.two", PrimaryCLIPath: "sample run", Visibility: SchemaVisibilityPublic}},
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func contractCoverageTool(product, name, cliPath string) ToolSpec {
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContractModelProvenanceValueAndDryRunEdges(t *testing.T) {
|
func TestCrossPlatformCoverageContractModelProvenanceValueAndDryRunEdges(t *testing.T) {
|
||||||
if err := (DryRunSpec{}).Validate(""); err == nil || !strings.Contains(err.Error(), "no preview_kind") {
|
if err := (DryRunSpec{}).Validate(""); err == nil || !strings.Contains(err.Error(), "no preview_kind") {
|
||||||
t.Fatalf("empty dry-run error = %v", err)
|
t.Fatalf("empty dry-run error = %v", err)
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ func TestContractModelProvenanceValueAndDryRunEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaIndexRemainingCollisionEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaIndexRemainingCollisionEdges(t *testing.T) {
|
||||||
base := contractCoverageTool("sample", "run", "sample run")
|
base := contractCoverageTool("sample", "run", "sample run")
|
||||||
alias := base
|
alias := base
|
||||||
alias.Identity.IsAlias = true
|
alias.Identity.IsAlias = true
|
||||||
@@ -88,7 +88,7 @@ func TestSchemaIndexRemainingCollisionEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaSnapshotRendererDependencyEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaSnapshotRendererDependencyEdges(t *testing.T) {
|
||||||
oldToolSummary := snapshotToolSummary
|
oldToolSummary := snapshotToolSummary
|
||||||
oldToolPayload := snapshotToolPayload
|
oldToolPayload := snapshotToolPayload
|
||||||
oldProductSummary := snapshotProductSummary
|
oldProductSummary := snapshotProductSummary
|
||||||
@@ -125,7 +125,7 @@ func TestSchemaSnapshotRendererDependencyEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestToolSpecValidationRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageToolSpecValidationRemainingEdges(t *testing.T) {
|
||||||
base := contractCoverageTool("sample", "run", "sample run")
|
base := contractCoverageTool("sample", "run", "sample run")
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -162,7 +162,7 @@ func TestToolSpecValidationRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFinalFieldProvenanceRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageFinalFieldProvenanceRemainingEdges(t *testing.T) {
|
||||||
if err := validateFinalFieldProvenance("owner", "field", FieldProvenance{}, func() {}); err == nil || !strings.Contains(err.Error(), "cannot encode") {
|
if err := validateFinalFieldProvenance("owner", "field", FieldProvenance{}, func() {}); err == nil || !strings.Contains(err.Error(), "cannot encode") {
|
||||||
t.Fatalf("final encode error = %v", err)
|
t.Fatalf("final encode error = %v", err)
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ func TestFinalFieldProvenanceRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContractModelNormalizationSortEdges(t *testing.T) {
|
func TestCrossPlatformCoverageContractModelNormalizationSortEdges(t *testing.T) {
|
||||||
registry := SchemaRegistry{Products: []ProductSpec{{
|
registry := SchemaRegistry{Products: []ProductSpec{{
|
||||||
ID: " sample ",
|
ID: " sample ",
|
||||||
Tools: []ToolSpec{
|
Tools: []ToolSpec{
|
||||||
@@ -212,7 +212,7 @@ func TestContractModelNormalizationSortEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContractModelPayloadErrorEdges(t *testing.T) {
|
func TestCrossPlatformCoverageContractModelPayloadErrorEdges(t *testing.T) {
|
||||||
invalidRegistry := SchemaRegistry{Products: []ProductSpec{{ID: " "}}}
|
invalidRegistry := SchemaRegistry{Products: []ProductSpec{{ID: " "}}}
|
||||||
if _, err := invalidRegistry.ToPayload(); err == nil {
|
if _, err := invalidRegistry.ToPayload(); err == nil {
|
||||||
t.Fatal("invalid registry ToPayload succeeded")
|
t.Fatal("invalid registry ToPayload succeeded")
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func requireDeliveryProblem(t *testing.T, loaded loadedSchemaCatalog, want strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaDeliveryInvariantBoundaryErrors(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaDeliveryInvariantBoundaryErrors(t *testing.T) {
|
||||||
badSnapshot := SchemaCatalogSnapshot{Catalog: map[string]any{"bad": func() {}}}
|
badSnapshot := SchemaCatalogSnapshot{Catalog: map[string]any{"bad": func() {}}}
|
||||||
if err := ValidateSchemaDeliveryInvariants(SchemaRegistry{}, badSnapshot); err == nil || !strings.Contains(err.Error(), "encode final") {
|
if err := ValidateSchemaDeliveryInvariants(SchemaRegistry{}, badSnapshot); err == nil || !strings.Contains(err.Error(), "encode final") {
|
||||||
t.Fatalf("ValidateSchemaDeliveryInvariants() marshal error = %v", err)
|
t.Fatalf("ValidateSchemaDeliveryInvariants() marshal error = %v", err)
|
||||||
@@ -69,7 +69,7 @@ func TestSchemaDeliveryInvariantBoundaryErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaJSONDifferenceRemainingShapes(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaJSONDifferenceRemainingShapes(t *testing.T) {
|
||||||
path, left, _ := firstSchemaJSONDifference(func() {}, map[string]any{})
|
path, left, _ := firstSchemaJSONDifference(func() {}, map[string]any{})
|
||||||
if path != "$" || !strings.Contains(left, "encode error") {
|
if path != "$" || !strings.Contains(left, "encode error") {
|
||||||
t.Fatalf("encode difference = %q %q", path, left)
|
t.Fatalf("encode difference = %q %q", path, left)
|
||||||
@@ -104,7 +104,7 @@ func TestSchemaJSONDifferenceRemainingShapes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaDeliveryInvariantProjectionEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaDeliveryInvariantProjectionEdges(t *testing.T) {
|
||||||
oldRegistry := deliveryRegistryPayload
|
oldRegistry := deliveryRegistryPayload
|
||||||
oldQuery := deliverySchemaPayload
|
oldQuery := deliverySchemaPayload
|
||||||
oldOverview := deliveryOverviewPayload
|
oldOverview := deliveryOverviewPayload
|
||||||
@@ -258,7 +258,7 @@ func TestSchemaDeliveryInvariantProjectionEdges(t *testing.T) {
|
|||||||
requireDeliveryProblem(t, loaded, "Catalog full tools contain 2 tools")
|
requireDeliveryProblem(t, loaded, "Catalog full tools contain 2 tools")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaDeliveryToolExtractionAndAliasPathEdge(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaDeliveryToolExtractionAndAliasPathEdge(t *testing.T) {
|
||||||
payload := map[string]any{"products": []map[string]any{{"tools": []map[string]any{{"title": "missing"}}}}}
|
payload := map[string]any{"products": []map[string]any{{"tools": []map[string]any{{"title": "missing"}}}}}
|
||||||
_, problems := schemaDeliveryToolsByCanonical(payload, "view")
|
_, problems := schemaDeliveryToolsByCanonical(payload, "view")
|
||||||
if len(problems) != 1 || !strings.Contains(problems[0], "without canonical_path") {
|
if len(problems) != 1 || !strings.Contains(problems[0], "without canonical_path") {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
// test package. Keeping this here (rather than in a generator package) means
|
// test package. Keeping this here (rather than in a generator package) means
|
||||||
// Go's normal per-package coverage accounting attributes the exercised Schema
|
// Go's normal per-package coverage accounting attributes the exercised Schema
|
||||||
// assembly code to internal/cli.
|
// assembly code to internal/cli.
|
||||||
func TestProductionSchemaSourcePipeline(t *testing.T) {
|
func TestCrossPlatformCoverageProductionSchemaSourcePipeline(t *testing.T) {
|
||||||
root := app.NewRootCommand()
|
root := app.NewRootCommand()
|
||||||
resolved, err := cli.ResolveSchemaBuild(root)
|
resolved, err := cli.ResolveSchemaBuild(root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestManualSchemaHintDecodeAndValidationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageManualSchemaHintDecodeAndValidationEdges(t *testing.T) {
|
||||||
valid := ManualSchemaHintSnapshot{
|
valid := ManualSchemaHintSnapshot{
|
||||||
Schema: manualSchemaHintSchemaRef,
|
Schema: manualSchemaHintSchemaRef,
|
||||||
Version: manualSchemaHintVersion,
|
Version: manualSchemaHintVersion,
|
||||||
@@ -140,7 +140,7 @@ func TestManualSchemaHintDecodeAndValidationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestManualAgentExamplePlanAndParserEdges(t *testing.T) {
|
func TestCrossPlatformCoverageManualAgentExamplePlanAndParserEdges(t *testing.T) {
|
||||||
_, leaf := manualSchemaHintTestTree()
|
_, leaf := manualSchemaHintTestTree()
|
||||||
spec := BoundCommandSpec{
|
spec := BoundCommandSpec{
|
||||||
CommandSpec: CommandSpec{CanonicalPath: "sample.search_items", PrimaryCLIPath: "sample item search"},
|
CommandSpec: CommandSpec{CanonicalPath: "sample.search_items", PrimaryCLIPath: "sample item search"},
|
||||||
@@ -241,7 +241,7 @@ func TestManualAgentExamplePlanAndParserEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestManualAgentExampleCobraContractEdges(t *testing.T) {
|
func TestCrossPlatformCoverageManualAgentExampleCobraContractEdges(t *testing.T) {
|
||||||
root, leaf := manualSchemaHintTestTree()
|
root, leaf := manualSchemaHintTestTree()
|
||||||
root.PersistentFlags().StringP("format", "f", "", "format")
|
root.PersistentFlags().StringP("format", "f", "", "format")
|
||||||
leaf.Flags().BoolP("verbose", "v", false, "verbose")
|
leaf.Flags().BoolP("verbose", "v", false, "verbose")
|
||||||
@@ -325,7 +325,7 @@ func TestManualAgentExampleCobraContractEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApplyManualSchemaHintsAndAnnotationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApplyManualSchemaHintsAndAnnotationEdges(t *testing.T) {
|
||||||
if _, err := applyManualSchemaHints(nil, ManualSchemaHintSnapshot{Version: manualSchemaHintVersion}); err == nil || !strings.Contains(err.Error(), "root is nil") {
|
if _, err := applyManualSchemaHints(nil, ManualSchemaHintSnapshot{Version: manualSchemaHintVersion}); err == nil || !strings.Contains(err.Error(), "root is nil") {
|
||||||
t.Fatalf("nil root error = %v", err)
|
t.Fatalf("nil root error = %v", err)
|
||||||
}
|
}
|
||||||
@@ -470,7 +470,7 @@ func TestApplyManualSchemaHintsAndAnnotationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEmbeddedManualSchemaHintWrapperErrors(t *testing.T) {
|
func TestCrossPlatformCoverageEmbeddedManualSchemaHintWrapperErrors(t *testing.T) {
|
||||||
previous := loadManualSchemaHints
|
previous := loadManualSchemaHints
|
||||||
loadManualSchemaHints = func() (ManualSchemaHintSnapshot, error) {
|
loadManualSchemaHints = func() (ManualSchemaHintSnapshot, error) {
|
||||||
return ManualSchemaHintSnapshot{}, errors.New("hints failed")
|
return ManualSchemaHintSnapshot{}, errors.New("hints failed")
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func validParameterBindingSnapshotForCoverage(t *testing.T) schemaParameterBindi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaParameterBindingSnapshotAuditEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaParameterBindingSnapshotAuditEdges(t *testing.T) {
|
||||||
valid := validParameterBindingSnapshotForCoverage(t)
|
valid := validParameterBindingSnapshotForCoverage(t)
|
||||||
encoded, err := json.Marshal(valid)
|
encoded, err := json.Marshal(valid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -112,7 +112,7 @@ func TestSchemaParameterBindingSnapshotAuditEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaParameterBindingDeliveryRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaParameterBindingDeliveryRemainingEdges(t *testing.T) {
|
||||||
command := &cobra.Command{Use: "read"}
|
command := &cobra.Command{Use: "read"}
|
||||||
command.Flags().String("id", "", "id")
|
command.Flags().String("id", "", "id")
|
||||||
boundSpec := BoundCommandSpec{CommandSpec: CommandSpec{CanonicalPath: "sample.read", Visibility: SchemaVisibilityPublic}, PrimaryCommand: command}
|
boundSpec := BoundCommandSpec{CommandSpec: CommandSpec{CanonicalPath: "sample.read", Visibility: SchemaVisibilityPublic}, PrimaryCommand: command}
|
||||||
@@ -186,7 +186,7 @@ func TestSchemaParameterBindingDeliveryRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaParameterBindingHelpersAndLoaderErrors(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaParameterBindingHelpersAndLoaderErrors(t *testing.T) {
|
||||||
if _, ok := finalSchemaParameterByName(ToolSpec{}, "missing"); ok {
|
if _, ok := finalSchemaParameterByName(ToolSpec{}, "missing"); ok {
|
||||||
t.Fatal("missing parameter found")
|
t.Fatal("missing parameter found")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCommandRegistryLoaderErrorWrappers(t *testing.T) {
|
func TestCrossPlatformCoverageCommandRegistryLoaderErrorWrappers(t *testing.T) {
|
||||||
previousRegistry := loadReviewedCommandRegistry
|
previousRegistry := loadReviewedCommandRegistry
|
||||||
previousBindings := validateReviewedParameterBindings
|
previousBindings := validateReviewedParameterBindings
|
||||||
previousManual := loadReviewedManualSchemaHints
|
previousManual := loadReviewedManualSchemaHints
|
||||||
@@ -47,7 +47,7 @@ func TestCommandRegistryLoaderErrorWrappers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommandRegistryDecodeAndIndexRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCommandRegistryDecodeAndIndexRemainingEdges(t *testing.T) {
|
||||||
base := func(products string) string {
|
base := func(products string) string {
|
||||||
return `{"$schema":"./schema_command_registry.schema.json","version":1,"products":` + products + `}`
|
return `{"$schema":"./schema_command_registry.schema.json","version":1,"products":` + products + `}`
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ func TestCommandRegistryDecodeAndIndexRemainingEdges(t *testing.T) {
|
|||||||
_ = hashCommandSpecs([]CommandSpec{{CanonicalPath: "sample.get", PrimaryCLIPath: "sample get"}})
|
_ = hashCommandSpecs([]CommandSpec{{CanonicalPath: "sample.get", PrimaryCLIPath: "sample get"}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEffectiveCommandRegistryRemainingErrors(t *testing.T) {
|
func TestCrossPlatformCoverageEffectiveCommandRegistryRemainingErrors(t *testing.T) {
|
||||||
if _, err := BuildEffectiveCommandRegistry(nil); err == nil {
|
if _, err := BuildEffectiveCommandRegistry(nil); err == nil {
|
||||||
t.Fatal("nil effective root succeeded")
|
t.Fatal("nil effective root succeeded")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestResolveAndAssembleSchemaRegistryErrorBoundaries(t *testing.T) {
|
func TestCrossPlatformCoverageResolveAndAssembleSchemaRegistryErrorBoundaries(t *testing.T) {
|
||||||
oldApply := resolveApplyManualSchemaHints
|
oldApply := resolveApplyManualSchemaHints
|
||||||
oldEffective := resolveEffectiveCommandRegistry
|
oldEffective := resolveEffectiveCommandRegistry
|
||||||
oldBind := resolveBoundCommandRegistry
|
oldBind := resolveBoundCommandRegistry
|
||||||
@@ -121,7 +121,7 @@ func TestResolveAndAssembleSchemaRegistryErrorBoundaries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeToolSpecDependencyErrors(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeToolSpecDependencyErrors(t *testing.T) {
|
||||||
oldDryRun := resolveReviewedDryRun
|
oldDryRun := resolveReviewedDryRun
|
||||||
oldText := resolveRuntimeToolText
|
oldText := resolveRuntimeToolText
|
||||||
oldParameters := resolveRuntimeParameters
|
oldParameters := resolveRuntimeParameters
|
||||||
@@ -157,7 +157,7 @@ func TestRuntimeToolSpecDependencyErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeSchemaRegistryPayloadBranches(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeSchemaRegistryPayloadBranches(t *testing.T) {
|
||||||
oldSnapshot := renderRegistrySnapshot
|
oldSnapshot := renderRegistrySnapshot
|
||||||
oldPayload := renderRegistryPayload
|
oldPayload := renderRegistryPayload
|
||||||
oldProduct := renderRegistryProductSummary
|
oldProduct := renderRegistryProductSummary
|
||||||
@@ -233,7 +233,7 @@ func TestRuntimeSchemaRegistryPayloadBranches(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeRegistryIdentityAndAgentMetadataRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRuntimeRegistryIdentityAndAgentMetadataRemainingEdges(t *testing.T) {
|
||||||
baseTool := ToolSpec{Identity: ToolIdentitySpec{
|
baseTool := ToolSpec{Identity: ToolIdentitySpec{
|
||||||
ProductID: "sample", Name: "run", CanonicalPath: "sample.run", Path: "sample.run",
|
ProductID: "sample", Name: "run", CanonicalPath: "sample.run", Path: "sample.run",
|
||||||
CLIPath: "sample run", PrimaryCLIPath: "sample run", Aliases: []string{"sample execute"}, Source: "registry",
|
CLIPath: "sample run", PrimaryCLIPath: "sample run", Aliases: []string{"sample execute"}, Source: "registry",
|
||||||
@@ -317,7 +317,7 @@ func TestRuntimeRegistryIdentityAndAgentMetadataRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFinalSchemaProvenanceRejectsInvalidTool(t *testing.T) {
|
func TestCrossPlatformCoverageFinalSchemaProvenanceRejectsInvalidTool(t *testing.T) {
|
||||||
registry := SchemaRegistry{Products: []ProductSpec{{
|
registry := SchemaRegistry{Products: []ProductSpec{{
|
||||||
ID: "sample",
|
ID: "sample",
|
||||||
Selection: SelectionSpec{AgentSummary: "summary", UseWhen: []string{}, AvoidWhen: []string{}},
|
Selection: SelectionSpec{AgentSummary: "summary", UseWhen: []string{}, AvoidWhen: []string{}},
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSchemaCommandRemainingBranches(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaCommandRemainingBranches(t *testing.T) {
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
@@ -57,7 +57,7 @@ func TestSchemaCommandRemainingBranches(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaCommandCatalogFailure(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaCommandCatalogFailure(t *testing.T) {
|
||||||
original := schemaCommandCatalogError
|
original := schemaCommandCatalogError
|
||||||
t.Cleanup(func() { schemaCommandCatalogError = original })
|
t.Cleanup(func() { schemaCommandCatalogError = original })
|
||||||
schemaCommandCatalogError = func() error { return errors.New("catalog failed") }
|
schemaCommandCatalogError = func() error { return errors.New("catalog failed") }
|
||||||
@@ -68,7 +68,7 @@ func TestSchemaCommandCatalogFailure(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaSupportParameterAndIdentityEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaSupportParameterAndIdentityEdges(t *testing.T) {
|
||||||
if hasRuntimeSchemaCommand(nil) {
|
if hasRuntimeSchemaCommand(nil) {
|
||||||
t.Fatal("nil command has runtime schema")
|
t.Fatal("nil command has runtime schema")
|
||||||
}
|
}
|
||||||
@@ -99,14 +99,14 @@ func TestSchemaSupportParameterAndIdentityEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAgentMetadataRemainingPureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAgentMetadataRemainingPureEdges(t *testing.T) {
|
||||||
provenance := resolvedFieldProvenance(make(chan int), " source ", " ref ", " precedence ", " resolution ", " reason ")
|
provenance := resolvedFieldProvenance(make(chan int), " source ", " ref ", " precedence ", " resolution ", " reason ")
|
||||||
if string(provenance.Value) != "null" || len(provenance.Candidates) != 1 {
|
if string(provenance.Value) != "null" || len(provenance.Candidates) != 1 {
|
||||||
t.Fatalf("fallback provenance = %#v", provenance)
|
t.Fatalf("fallback provenance = %#v", provenance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEmbeddedAgentMetadataLoaderEdges(t *testing.T) {
|
func TestCrossPlatformCoverageEmbeddedAgentMetadataLoaderEdges(t *testing.T) {
|
||||||
for _, source := range []fs.FS{
|
for _, source := range []fs.FS{
|
||||||
fstest.MapFS{},
|
fstest.MapFS{},
|
||||||
fstest.MapFS{"schema_agent_metadata/index.json": {Data: []byte("{")}},
|
fstest.MapFS{"schema_agent_metadata/index.json": {Data: []byte("{")}},
|
||||||
@@ -137,7 +137,7 @@ func TestEmbeddedAgentMetadataLoaderEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestManualAgentSelectionRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageManualAgentSelectionRemainingEdges(t *testing.T) {
|
||||||
baseBound := manualAgentSelectionBoundFixture()
|
baseBound := manualAgentSelectionBoundFixture()
|
||||||
baseHints := manualAgentHintSetFixture()
|
baseHints := manualAgentHintSetFixture()
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
@@ -239,7 +239,7 @@ func cloneManualAgentTools(source map[string]ManualAgentToolHint) map[string]Man
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHintDirectoryLoaderRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageHintDirectoryLoaderRemainingEdges(t *testing.T) {
|
||||||
directoryJSON := fstest.MapFS{"bad.json": {Mode: fs.ModeDir}}
|
directoryJSON := fstest.MapFS{"bad.json": {Mode: fs.ModeDir}}
|
||||||
invalidJSON := fstest.MapFS{"bad.json": {Data: []byte("{")}}
|
invalidJSON := fstest.MapFS{"bad.json": {Data: []byte("{")}}
|
||||||
if _, err := loadParameterCommandsFromMetadata(fstest.MapFS{}, "["); err == nil {
|
if _, err := loadParameterCommandsFromMetadata(fstest.MapFS{}, "["); err == nil {
|
||||||
@@ -292,7 +292,7 @@ func TestHintDirectoryLoaderRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInterfaceRegistryRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageInterfaceRegistryRemainingEdges(t *testing.T) {
|
||||||
ref := &embeddedMCPInterfaceRef{ProductID: "sample", RPCName: "get"}
|
ref := &embeddedMCPInterfaceRef{ProductID: "sample", RPCName: "get"}
|
||||||
for _, tools := range []map[string]embeddedMCPToolMetadata{
|
for _, tools := range []map[string]embeddedMCPToolMetadata{
|
||||||
{" ": {InterfaceRef: ref}},
|
{" ": {InterfaceRef: ref}},
|
||||||
@@ -326,7 +326,7 @@ func TestInterfaceRegistryRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReviewedDryRunCapabilityRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageReviewedDryRunCapabilityRemainingEdges(t *testing.T) {
|
||||||
originalGroups := reviewedDryRunCapabilityGroups
|
originalGroups := reviewedDryRunCapabilityGroups
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
reviewedDryRunCapabilityGroups = originalGroups
|
reviewedDryRunCapabilityGroups = originalGroups
|
||||||
@@ -382,7 +382,7 @@ func resetReviewedDryRunCapabilitiesForTest() {
|
|||||||
reviewedDryRunCapabilitiesLazy.err = nil
|
reviewedDryRunCapabilitiesLazy.err = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSchemaSnapshotAdapterRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSchemaSnapshotAdapterRemainingEdges(t *testing.T) {
|
||||||
if _, err := schemaToolSpecFromPayload(map[string]any{"bad": make(chan int)}); err == nil {
|
if _, err := schemaToolSpecFromPayload(map[string]any{"bad": make(chan int)}); err == nil {
|
||||||
t.Fatal("unmarshalable tool payload succeeded")
|
t.Fatal("unmarshalable tool payload succeeded")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestReadFileBoundedPermissionDenied(t *testing.T) {
|
func TestCrossPlatformCoverageReadFileBoundedPermissionDenied(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
path := filepath.Join(t.TempDir(), "noperm.txt")
|
path := filepath.Join(t.TempDir(), "noperm.txt")
|
||||||
writeTestFile(t, path, []byte("secret"))
|
writeTestFile(t, path, []byte("secret"))
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDiagnosticsAndErrorRenderingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDiagnosticsAndErrorRenderingEdges(t *testing.T) {
|
||||||
retryable := false
|
retryable := false
|
||||||
err := NewAPI("message",
|
err := NewAPI("message",
|
||||||
nil,
|
nil,
|
||||||
@@ -72,7 +72,7 @@ func TestDiagnosticsAndErrorRenderingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidationCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageValidationCoverageEdges(t *testing.T) {
|
||||||
for _, name := range []string{"", strings.Repeat("a", 129), "1startsWithDigit", "bad name"} {
|
for _, name := range []string{"", strings.Repeat("a", 129), "1startsWithDigit", "bad name"} {
|
||||||
if ResourceName(name) == nil {
|
if ResourceName(name) == nil {
|
||||||
t.Errorf("ResourceName(%q) should fail", name)
|
t.Errorf("ResourceName(%q) should fail", name)
|
||||||
@@ -147,7 +147,7 @@ func TestValidationCoverageEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPATURLAndMutationCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoveragePATURLAndMutationCoverageEdges(t *testing.T) {
|
||||||
oldHost := hostControlProvider
|
oldHost := hostControlProvider
|
||||||
oldBrowser := patBrowserProvider
|
oldBrowser := patBrowserProvider
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -216,7 +216,7 @@ func mustParseURLForTest(t *testing.T, raw string) *url.URL {
|
|||||||
return parsed
|
return parsed
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInvalidRPCDataIsOmitted(t *testing.T) {
|
func TestCrossPlatformCoverageInvalidRPCDataIsOmitted(t *testing.T) {
|
||||||
err := NewAPI("bad rpc", WithRPCData(json.RawMessage(`{`)))
|
err := NewAPI("bad rpc", WithRPCData(json.RawMessage(`{`)))
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
if printErr := PrintJSON(&out, err); printErr != nil {
|
if printErr := PrintJSON(&out, err); printErr != nil {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
|
|
||||||
var errBusInjected = errors.New("injected bus failure")
|
var errBusInjected = errors.New("injected bus failure")
|
||||||
|
|
||||||
func TestMatcherConsumerAndCounterEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMatcherConsumerAndCounterEdges(t *testing.T) {
|
||||||
m, err := compileMatcher([]string{"", "*", "im.*", "prefix*", "exact"}, "^im", " sub ")
|
m, err := compileMatcher([]string{"", "*", "im.*", "prefix*", "exact"}, "^im", " sub ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -100,7 +100,7 @@ func TestMatcherConsumerAndCounterEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDropWarningScanEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDropWarningScanEdges(t *testing.T) {
|
||||||
origInterval := dropWarnTickInterval
|
origInterval := dropWarnTickInterval
|
||||||
t.Cleanup(func() { dropWarnTickInterval = origInterval })
|
t.Cleanup(func() { dropWarnTickInterval = origInterval })
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
@@ -140,7 +140,7 @@ func TestDropWarningScanEdges(t *testing.T) {
|
|||||||
dropWarnWatcher(ctx, c, logger, 25)
|
dropWarnWatcher(ctx, c, logger, 25)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLockFailureInjection(t *testing.T) {
|
func TestCrossPlatformCoverageLockFailureInjection(t *testing.T) {
|
||||||
origTry := busTryAcquire
|
origTry := busTryAcquire
|
||||||
origSeek := busSeek
|
origSeek := busSeek
|
||||||
origRead := busReadAll
|
origRead := busReadAll
|
||||||
@@ -231,7 +231,7 @@ func TestLockFailureInjection(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetaFailureInjection(t *testing.T) {
|
func TestCrossPlatformCoverageMetaFailureInjection(t *testing.T) {
|
||||||
origMarshal := metaMarshalIndent
|
origMarshal := metaMarshalIndent
|
||||||
origWrite := metaWriteFile
|
origWrite := metaWriteFile
|
||||||
origRename := metaRename
|
origRename := metaRename
|
||||||
@@ -266,7 +266,7 @@ type edgeSource struct {
|
|||||||
|
|
||||||
func (s edgeSource) Start(ctx context.Context, emit dwsevent.EmitFn) error { return s.start(ctx, emit) }
|
func (s edgeSource) Start(ctx context.Context, emit dwsevent.EmitFn) error { return s.start(ctx, emit) }
|
||||||
|
|
||||||
func TestRunStartupAndSourceEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunStartupAndSourceEdges(t *testing.T) {
|
||||||
if err := Run(context.Background(), Config{}); err == nil {
|
if err := Run(context.Background(), Config{}); err == nil {
|
||||||
t.Fatal("source validation expected")
|
t.Fatal("source validation expected")
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ func (l *scriptedListener) Accept() (net.Conn, error) { return l.accept() }
|
|||||||
func (l *scriptedListener) Close() error { l.closed = true; return nil }
|
func (l *scriptedListener) Close() error { l.closed = true; return nil }
|
||||||
func (*scriptedListener) Endpoint() string { return "edge" }
|
func (*scriptedListener) Endpoint() string { return "edge" }
|
||||||
|
|
||||||
func TestDaemonMethodEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonMethodEdges(t *testing.T) {
|
||||||
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
||||||
calls := 0
|
calls := 0
|
||||||
l := &scriptedListener{accept: func() (net.Conn, error) {
|
l := &scriptedListener{accept: func() (net.Conn, error) {
|
||||||
@@ -400,7 +400,7 @@ func TestDaemonMethodEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHandleConnectionProtocolEdges(t *testing.T) {
|
func TestCrossPlatformCoverageHandleConnectionProtocolEdges(t *testing.T) {
|
||||||
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
||||||
newDaemon := func() *daemon {
|
newDaemon := func() *daemon {
|
||||||
return &daemon{
|
return &daemon{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
var errBusctlInjected = errors.New("injected busctl failure")
|
var errBusctlInjected = errors.New("injected busctl failure")
|
||||||
|
|
||||||
func TestDiscoverValidationAndFailures(t *testing.T) {
|
func TestCrossPlatformCoverageDiscoverValidationAndFailures(t *testing.T) {
|
||||||
for name, cfg := range map[string]DiscoverConfig{
|
for name, cfg := range map[string]DiscoverConfig{
|
||||||
"workdir": {IPCEndpoint: "endpoint", ClientID: "id"},
|
"workdir": {IPCEndpoint: "endpoint", ClientID: "id"},
|
||||||
"endpoint": {WorkDir: t.TempDir(), ClientID: "id"},
|
"endpoint": {WorkDir: t.TempDir(), ClientID: "id"},
|
||||||
@@ -53,7 +53,7 @@ func TestDiscoverValidationAndFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWaitReadyRejectsShortSuccessfulRead(t *testing.T) {
|
func TestCrossPlatformCoverageWaitReadyRejectsShortSuccessfulRead(t *testing.T) {
|
||||||
original := busctlReadFull
|
original := busctlReadFull
|
||||||
t.Cleanup(func() { busctlReadFull = original })
|
t.Cleanup(func() { busctlReadFull = original })
|
||||||
busctlReadFull = func(io.Reader, []byte) (int, error) { return 0, nil }
|
busctlReadFull = func(io.Reader, []byte) (int, error) { return 0, nil }
|
||||||
@@ -68,7 +68,7 @@ func TestWaitReadyRejectsShortSuccessfulRead(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSpawnAndReadyFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSpawnAndReadyFailureEdges(t *testing.T) {
|
||||||
origExecutable := spawnExecutable
|
origExecutable := spawnExecutable
|
||||||
origPipe := spawnPipe
|
origPipe := spawnPipe
|
||||||
origTimeout := ReadyTimeout
|
origTimeout := ReadyTimeout
|
||||||
@@ -147,7 +147,7 @@ func TestSpawnAndReadyFailureEdges(t *testing.T) {
|
|||||||
_ = pw.Close()
|
_ = pw.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStatusFilesystemEdges(t *testing.T) {
|
func TestCrossPlatformCoverageStatusFilesystemEdges(t *testing.T) {
|
||||||
origReadDir := statusReadDir
|
origReadDir := statusReadDir
|
||||||
origStat := statusStat
|
origStat := statusStat
|
||||||
t.Cleanup(func() { statusReadDir = origReadDir; statusStat = origStat })
|
t.Cleanup(func() { statusReadDir = origReadDir; statusStat = origStat })
|
||||||
@@ -249,7 +249,7 @@ type dummyAddr string
|
|||||||
func (a dummyAddr) Network() string { return string(a) }
|
func (a dummyAddr) Network() string { return string(a) }
|
||||||
func (a dummyAddr) String() string { return string(a) }
|
func (a dummyAddr) String() string { return string(a) }
|
||||||
|
|
||||||
func TestQueryStatusAndEntryEdges(t *testing.T) {
|
func TestCrossPlatformCoverageQueryStatusAndEntryEdges(t *testing.T) {
|
||||||
origDial := statusDial
|
origDial := statusDial
|
||||||
origQuery := queryStatus
|
origQuery := queryStatus
|
||||||
t.Cleanup(func() { statusDial = origDial; queryStatus = origQuery })
|
t.Cleanup(func() { statusDial = origDial; queryStatus = origQuery })
|
||||||
@@ -282,7 +282,7 @@ func TestQueryStatusAndEntryEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStopInjectedEdges(t *testing.T) {
|
func TestCrossPlatformCoverageStopInjectedEdges(t *testing.T) {
|
||||||
origRead := stopReadHolderPID
|
origRead := stopReadHolderPID
|
||||||
origAlive := stopAlive
|
origAlive := stopAlive
|
||||||
origFind := stopFindProcess
|
origFind := stopFindProcess
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPortableDefaultFunctionCoverage(t *testing.T) {
|
func TestCrossPlatformCoveragePortableDefaultFunctionCoverage(t *testing.T) {
|
||||||
originalDiscoverDial := discoverDial
|
originalDiscoverDial := discoverDial
|
||||||
client, server := net.Pipe()
|
client, server := net.Pipe()
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type errorSink struct{ err error }
|
|||||||
func (s errorSink) Write(transport.Event, []byte) error { return s.err }
|
func (s errorSink) Write(transport.Event, []byte) error { return s.err }
|
||||||
func (s errorSink) Close() error { return s.err }
|
func (s errorSink) Close() error { return s.err }
|
||||||
|
|
||||||
func TestFormatterPipelineRouterAndSinkEdges(t *testing.T) {
|
func TestCrossPlatformCoverageFormatterPipelineRouterAndSinkEdges(t *testing.T) {
|
||||||
wantErr := errors.New("synthetic failure")
|
wantErr := errors.New("synthetic failure")
|
||||||
oldMarshal, oldIndent, oldCompact := marshalEvent, marshalEventIndent, marshalCompact
|
oldMarshal, oldIndent, oldCompact := marshalEvent, marshalEventIndent, marshalCompact
|
||||||
oldMkdir, oldWrite, oldRename, oldRemove := mkdirSinkDir, writeSinkFile, renameSinkFile, removeSinkFile
|
oldMkdir, oldWrite, oldRename, oldRemove := mkdirSinkDir, writeSinkFile, renameSinkFile, removeSinkFile
|
||||||
@@ -103,7 +103,7 @@ func validRunConfig() Config {
|
|||||||
return Config{WorkDir: "work", IPCEndpoint: "endpoint", ClientID: "client", Stdout: io.Discard, Stderr: io.Discard, Format: FormatNDJSON}
|
return Config{WorkDir: "work", IPCEndpoint: "endpoint", ClientID: "client", Stdout: io.Discard, Stderr: io.Discard, Format: FormatNDJSON}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunSetupAndDiscoveryEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunSetupAndDiscoveryEdges(t *testing.T) {
|
||||||
if err := Run(context.Background(), Config{}); err == nil {
|
if err := Run(context.Background(), Config{}); err == nil {
|
||||||
t.Fatal("missing required run config should fail")
|
t.Fatal("missing required run config should fail")
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ func TestRunSetupAndDiscoveryEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunFrameAndDeliveryEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunFrameAndDeliveryEdges(t *testing.T) {
|
||||||
oldDiscover := discoverBus
|
oldDiscover := discoverBus
|
||||||
t.Cleanup(func() { discoverBus = oldDiscover })
|
t.Cleanup(func() { discoverBus = oldDiscover })
|
||||||
ack := mustJSONFrame(t, transport.HelloAck{Type: transport.FrameTypeHelloAck, BusPID: 1})
|
ack := mustJSONFrame(t, transport.HelloAck{Type: transport.FrameTypeHelloAck, BusPID: 1})
|
||||||
@@ -282,7 +282,7 @@ type consumeAddr string
|
|||||||
func (a consumeAddr) Network() string { return "test" }
|
func (a consumeAddr) Network() string { return "test" }
|
||||||
func (a consumeAddr) String() string { return string(a) }
|
func (a consumeAddr) String() string { return string(a) }
|
||||||
|
|
||||||
func TestWatchStdinEOFCancelledAfterData(t *testing.T) {
|
func TestCrossPlatformCoverageWatchStdinEOFCancelledAfterData(t *testing.T) {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
cancel()
|
cancel()
|
||||||
called := false
|
called := false
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEndpointPortableCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageEndpointPortableCoverageEdges(t *testing.T) {
|
||||||
if got := MaxUnixSocketPath(); got != 103 && got != 107 {
|
if got := MaxUnixSocketPath(); got != 103 && got != 107 {
|
||||||
t.Fatalf("MaxUnixSocketPath() = %d", got)
|
t.Fatalf("MaxUnixSocketPath() = %d", got)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTryAcquireErrorBranchesAndEmptyPath(t *testing.T) {
|
func TestCrossPlatformCoverageTryAcquireErrorBranchesAndEmptyPath(t *testing.T) {
|
||||||
if lock, err := TryAcquire(filepath.Join(t.TempDir(), "missing", "lock")); err == nil || lock != nil {
|
if lock, err := TryAcquire(filepath.Join(t.TempDir(), "missing", "lock")); err == nil || lock != nil {
|
||||||
t.Fatalf("TryAcquire missing parent = %#v, %v", lock, err)
|
t.Fatalf("TryAcquire missing parent = %#v, %v", lock, err)
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ func TestTryAcquireErrorBranchesAndEmptyPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTryAcquire_FirstCallerWins(t *testing.T) {
|
func TestCrossPlatformCoverageTryAcquire_FirstCallerWins(t *testing.T) {
|
||||||
path := filepath.Join(t.TempDir(), "bus.lock")
|
path := filepath.Join(t.TempDir(), "bus.lock")
|
||||||
l, err := TryAcquire(path)
|
l, err := TryAcquire(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -50,7 +50,7 @@ func TestTryAcquire_FirstCallerWins(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTryAcquire_SecondCallerGetsBusy(t *testing.T) {
|
func TestCrossPlatformCoverageTryAcquire_SecondCallerGetsBusy(t *testing.T) {
|
||||||
path := filepath.Join(t.TempDir(), "bus.lock")
|
path := filepath.Join(t.TempDir(), "bus.lock")
|
||||||
l1, err := TryAcquire(path)
|
l1, err := TryAcquire(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -67,7 +67,7 @@ func TestTryAcquire_SecondCallerGetsBusy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTryAcquire_ReleasedLockIsReacquirable(t *testing.T) {
|
func TestCrossPlatformCoverageTryAcquire_ReleasedLockIsReacquirable(t *testing.T) {
|
||||||
path := filepath.Join(t.TempDir(), "bus.lock")
|
path := filepath.Join(t.TempDir(), "bus.lock")
|
||||||
l1, err := TryAcquire(path)
|
l1, err := TryAcquire(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -84,7 +84,7 @@ func TestTryAcquire_ReleasedLockIsReacquirable(t *testing.T) {
|
|||||||
defer l2.Close()
|
defer l2.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTryAcquire_ContentReadWriteWhileHeld(t *testing.T) {
|
func TestCrossPlatformCoverageTryAcquire_ContentReadWriteWhileHeld(t *testing.T) {
|
||||||
path := filepath.Join(t.TempDir(), "bus.lock")
|
path := filepath.Join(t.TempDir(), "bus.lock")
|
||||||
l, err := TryAcquire(path)
|
l, err := TryAcquire(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -111,7 +111,7 @@ func TestTryAcquire_ContentReadWriteWhileHeld(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClose_NilSafe(t *testing.T) {
|
func TestCrossPlatformCoverageClose_NilSafe(t *testing.T) {
|
||||||
var l *File
|
var l *File
|
||||||
if err := l.Close(); err != nil {
|
if err := l.Close(); err != nil {
|
||||||
t.Fatalf("nil Close should be no-op, got %v", err)
|
t.Fatalf("nil Close should be no-op, got %v", err)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func personalHTTPClient(status int, body string) *http.Client {
|
|||||||
})}
|
})}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalClientEdgeCases(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalClientEdgeCases(t *testing.T) {
|
||||||
if got := (Identity{}).Key(); !strings.HasPrefix(got, "unknown\x00") {
|
if got := (Identity{}).Key(); !strings.HasPrefix(got, "unknown\x00") {
|
||||||
t.Fatalf("unknown identity key = %q", got)
|
t.Fatalf("unknown identity key = %q", got)
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ func TestPersonalClientEdgeCases(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalClientHelpersAndOperations(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalClientHelpersAndOperations(t *testing.T) {
|
||||||
trueValue := true
|
trueValue := true
|
||||||
if (responseEnvelope{}).apiError() != nil {
|
if (responseEnvelope{}).apiError() != nil {
|
||||||
t.Fatal("empty response envelope returned an error")
|
t.Fatal("empty response envelope returned an error")
|
||||||
@@ -247,7 +247,7 @@ func TestPersonalClientHelpersAndOperations(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalPaginationFiltersAndGuard(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalPaginationFiltersAndGuard(t *testing.T) {
|
||||||
client := &Client{BaseURL: "http://example.test", Identity: Identity{AccessToken: "token"}}
|
client := &Client{BaseURL: "http://example.test", Identity: Identity{AccessToken: "token"}}
|
||||||
items := `[{"subId":"id1","status":2,"eventKey":"target"},{"subId":"id2","status":1,"eventKey":"other"},{"subId":"idx","status":1,"eventKey":"target"},{"subId":"id3","status":1,"eventKey":"target"}]`
|
items := `[{"subId":"id1","status":2,"eventKey":"target"},{"subId":"id2","status":1,"eventKey":"other"},{"subId":"idx","status":1,"eventKey":"target"},{"subId":"id3","status":1,"eventKey":"target"}]`
|
||||||
client.HTTPClient = personalHTTPClient(200, `{"success":true,"result":{"items":`+items+`}}`)
|
client.HTTPClient = personalHTTPClient(200, `{"success":true,"result":{"items":`+items+`}}`)
|
||||||
@@ -265,7 +265,7 @@ func TestPersonalPaginationFiltersAndGuard(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalRegistryEdgeCases(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalRegistryEdgeCases(t *testing.T) {
|
||||||
if got := (&SchemaPendingError{EventKey: "pending"}).Error(); !strings.Contains(got, "pending") {
|
if got := (&SchemaPendingError{EventKey: "pending"}).Error(); !strings.Contains(got, "pending") {
|
||||||
t.Fatalf("pending error = %q", got)
|
t.Fatalf("pending error = %q", got)
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ func TestPersonalRegistryEdgeCases(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunStateEdgeCases(t *testing.T) {
|
func TestCrossPlatformCoverageRunStateEdgeCases(t *testing.T) {
|
||||||
workDir := t.TempDir()
|
workDir := t.TempDir()
|
||||||
if err := UpsertRunState(workDir, RunState{}); err != nil {
|
if err := UpsertRunState(workDir, RunState{}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -370,7 +370,7 @@ func TestRunStateEdgeCases(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunStateInjectedFailures(t *testing.T) {
|
func TestCrossPlatformCoverageRunStateInjectedFailures(t *testing.T) {
|
||||||
originalRead := runStateReadFile
|
originalRead := runStateReadFile
|
||||||
originalMkdir := runStateMkdirAll
|
originalMkdir := runStateMkdirAll
|
||||||
originalAcquire := runStateTryAcquire
|
originalAcquire := runStateTryAcquire
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAliveUnixErrorClassification(t *testing.T) {
|
func TestCrossPlatformCoverageAliveUnixErrorClassification(t *testing.T) {
|
||||||
previous := killProcess
|
previous := killProcess
|
||||||
t.Cleanup(func() { killProcess = previous })
|
t.Cleanup(func() { killProcess = previous })
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func (c *fakeStreamClient) RegisterAllEventRouter(h handler.IFrameHandler) { c.h
|
|||||||
func (c *fakeStreamClient) Start(context.Context) error { return c.startErr }
|
func (c *fakeStreamClient) Start(context.Context) error { return c.startErr }
|
||||||
func (c *fakeStreamClient) Close() { c.closed = true }
|
func (c *fakeStreamClient) Close() { c.closed = true }
|
||||||
|
|
||||||
func TestDingtalkStartEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDingtalkStartEdges(t *testing.T) {
|
||||||
s, err := New(Config{ClientID: "id", ClientSecret: "secret"})
|
s, err := New(Config{ClientID: "id", ClientSecret: "secret"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -42,7 +42,7 @@ func TestDingtalkStartEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDingtalkStartInjected(t *testing.T) {
|
func TestCrossPlatformCoverageDingtalkStartInjected(t *testing.T) {
|
||||||
origNew := newStreamClient
|
origNew := newStreamClient
|
||||||
t.Cleanup(func() { newStreamClient = origNew })
|
t.Cleanup(func() { newStreamClient = origNew })
|
||||||
_ = origNew()
|
_ = origNew()
|
||||||
@@ -78,7 +78,7 @@ func staticPersonalTicketClient(endpoint, body string) *http.Client {
|
|||||||
})}
|
})}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonalRunAttemptAndFrameFailures(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalRunAttemptAndFrameFailures(t *testing.T) {
|
||||||
base := PersonalConfig{
|
base := PersonalConfig{
|
||||||
AccessToken: "token", ClientID: "id", SourceID: "source", TicketURL: "https://ticket",
|
AccessToken: "token", ClientID: "id", SourceID: "source", TicketURL: "https://ticket",
|
||||||
ReconnectMin: time.Millisecond, ReconnectMax: time.Millisecond,
|
ReconnectMin: time.Millisecond, ReconnectMax: time.Millisecond,
|
||||||
@@ -164,7 +164,7 @@ func TestPersonalRunAttemptAndFrameFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewAndPersonalValidationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageNewAndPersonalValidationEdges(t *testing.T) {
|
||||||
invalidPortal := &PortalTicketConfig{}
|
invalidPortal := &PortalTicketConfig{}
|
||||||
if _, err := New(Config{PortalTicket: invalidPortal}); err == nil {
|
if _, err := New(Config{PortalTicket: invalidPortal}); err == nil {
|
||||||
t.Fatal("invalid portal expected")
|
t.Fatal("invalid portal expected")
|
||||||
@@ -221,7 +221,7 @@ type errorReadCloser struct{}
|
|||||||
func (errorReadCloser) Read([]byte) (int, error) { return 0, errSourceInjected }
|
func (errorReadCloser) Read([]byte) (int, error) { return 0, errSourceInjected }
|
||||||
func (errorReadCloser) Close() error { return nil }
|
func (errorReadCloser) Close() error { return nil }
|
||||||
|
|
||||||
func TestPersonalTicketAndHelperEdges(t *testing.T) {
|
func TestCrossPlatformCoveragePersonalTicketAndHelperEdges(t *testing.T) {
|
||||||
clientWith := func(fn func(*http.Request) (*http.Response, error)) *http.Client {
|
clientWith := func(fn func(*http.Request) (*http.Response, error)) *http.Client {
|
||||||
return &http.Client{Transport: roundTripFunc(fn)}
|
return &http.Client{Transport: roundTripFunc(fn)}
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ func TestPersonalTicketAndHelperEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPortalConfigAndRequestEdges(t *testing.T) {
|
func TestCrossPlatformCoveragePortalConfigAndRequestEdges(t *testing.T) {
|
||||||
for name, cfg := range map[string]*PortalTicketConfig{
|
for name, cfg := range map[string]*PortalTicketConfig{
|
||||||
"nil": nil,
|
"nil": nil,
|
||||||
"url": {AccessToken: "t", SourceID: "s"},
|
"url": {AccessToken: "t", SourceID: "s"},
|
||||||
@@ -405,7 +405,7 @@ func TestPortalConfigAndRequestEdges(t *testing.T) {
|
|||||||
_ = truncatePortalTicketLog(" long value ", 4)
|
_ = truncatePortalTicketLog(" long value ", 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPortalStartEndToEndAndFailures(t *testing.T) {
|
func TestCrossPlatformCoveragePortalStartEndToEndAndFailures(t *testing.T) {
|
||||||
makeSource := func(cfg *PortalTicketConfig) *DingtalkSource {
|
makeSource := func(cfg *PortalTicketConfig) *DingtalkSource {
|
||||||
s, err := New(Config{PortalTicket: cfg})
|
s, err := New(Config{PortalTicket: cfg})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -477,7 +477,7 @@ func TestPortalStartEndToEndAndFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPortalStartHandshakeReadAndAckErrors(t *testing.T) {
|
func TestCrossPlatformCoveragePortalStartHandshakeReadAndAckErrors(t *testing.T) {
|
||||||
origWriteMessage := portalWriteMessage
|
origWriteMessage := portalWriteMessage
|
||||||
t.Cleanup(func() { portalWriteMessage = origWriteMessage })
|
t.Cleanup(func() { portalWriteMessage = origWriteMessage })
|
||||||
makeSource := func(endpoint string) *DingtalkSource {
|
makeSource := func(endpoint string) *DingtalkSource {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFrameCodecCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageFrameCodecCoverageEdges(t *testing.T) {
|
||||||
if _, err := NewReader(strings.NewReader("partial")).Read(); !errors.Is(err, io.EOF) {
|
if _, err := NewReader(strings.NewReader("partial")).Read(); !errors.Is(err, io.EOF) {
|
||||||
t.Fatalf("partial frame error = %v, want EOF", err)
|
t.Fatalf("partial frame error = %v, want EOF", err)
|
||||||
}
|
}
|
||||||
@@ -25,13 +25,18 @@ func TestFrameCodecCoverageEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUnixListenErrorCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageUnixListenErrorCoverage(t *testing.T) {
|
||||||
oldStat, oldRemove, oldListen, oldChmod := statSocket, removeSocket, listenUnix, chmodSocket
|
oldStat, oldRemove, oldListen, oldChmod := statSocket, removeSocket, listenUnix, chmodSocket
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
statSocket, removeSocket, listenUnix, chmodSocket = oldStat, oldRemove, oldListen, oldChmod
|
statSocket, removeSocket, listenUnix, chmodSocket = oldStat, oldRemove, oldListen, oldChmod
|
||||||
})
|
})
|
||||||
wantErr := errors.New("synthetic failure")
|
wantErr := errors.New("synthetic failure")
|
||||||
path := filepath.Join(t.TempDir(), "bus.sock")
|
tempDir, err := os.MkdirTemp("", "dws-et-")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("create short socket temp dir: %v", err)
|
||||||
|
}
|
||||||
|
t.Cleanup(func() { _ = os.RemoveAll(tempDir) })
|
||||||
|
path := filepath.Join(tempDir, "bus.sock")
|
||||||
if _, err := listen(strings.Repeat("x", 512)); err == nil {
|
if _, err := listen(strings.Repeat("x", 512)); err == nil {
|
||||||
t.Fatal("overlong socket path should fail")
|
t.Fatal("overlong socket path should fail")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFramePartialEOFPortable(t *testing.T) {
|
func TestCrossPlatformCoverageFramePartialEOFPortable(t *testing.T) {
|
||||||
frame, err := NewReader(strings.NewReader("partial")).Read()
|
frame, err := NewReader(strings.NewReader("partial")).Read()
|
||||||
if frame != nil || !errors.Is(err, io.EOF) {
|
if frame != nil || !errors.Is(err, io.EOF) {
|
||||||
t.Fatalf("partial frame = %q, %v; want nil, EOF", frame, err)
|
t.Fatalf("partial frame = %q, %v; want nil, EOF", frame, err)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInvocationBuildersAndEchoRunner(t *testing.T) {
|
func TestCrossPlatformCoverageInvocationBuildersAndEchoRunner(t *testing.T) {
|
||||||
params := map[string]any{"name": "value"}
|
params := map[string]any{"name": "value"}
|
||||||
compat := NewCompatibilityInvocation("old path", "doc", "read", params)
|
compat := NewCompatibilityInvocation("old path", "doc", "read", params)
|
||||||
if compat.Kind != "compat_invocation" || compat.CanonicalPath != "doc.read" || !reflect.DeepEqual(compat.Params, params) {
|
if compat.Kind != "compat_invocation" || compat.CanonicalPath != "doc.read" || !reflect.DeepEqual(compat.Params, params) {
|
||||||
@@ -41,7 +41,7 @@ func TestInvocationBuildersAndEchoRunner(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMergePayloadsAndToolCallRequest(t *testing.T) {
|
func TestCrossPlatformCoverageMergePayloadsAndToolCallRequest(t *testing.T) {
|
||||||
merged, err := MergePayloads(`{"a":1,"same":"json"}`, `{"b":2,"same":"params"}`, map[string]any{"c": 3, "same": "override"})
|
merged, err := MergePayloads(`{"a":1,"same":"json"}`, `{"b":2,"same":"params"}`, map[string]any{"c": 3, "same": "override"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("MergePayloads() error = %v", err)
|
t.Fatalf("MergePayloads() error = %v", err)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func validCoverageIndex(metadataPath, selectionPath string) string {
|
|||||||
return `{"version":1,"format":"dws-agent-hint-index","source":{"kind":"explicit"},"metadata":{"sample":"` + metadataPath + `"},"selection":{"sample":"` + selectionPath + `"}}`
|
return `{"version":1,"format":"dws-agent-hint-index","source":{"kind":"explicit"},"metadata":{"sample":"` + metadataPath + `"},"selection":{"sample":"` + selectionPath + `"}}`
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHintUnmarshalAndIndexValidationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageHintUnmarshalAndIndexValidationEdges(t *testing.T) {
|
||||||
if err := json.Unmarshal([]byte(`{`), &HintProduct{}); err == nil {
|
if err := json.Unmarshal([]byte(`{`), &HintProduct{}); err == nil {
|
||||||
t.Fatal("invalid HintProduct succeeded")
|
t.Fatal("invalid HintProduct succeeded")
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ func TestHintUnmarshalAndIndexValidationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHintFileAndRoleValidationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageHintFileAndRoleValidationEdges(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -128,7 +128,7 @@ func TestHintFileAndRoleValidationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHintHelperRemainingBranches(t *testing.T) {
|
func TestCrossPlatformCoverageHintHelperRemainingBranches(t *testing.T) {
|
||||||
falseValue := false
|
falseValue := false
|
||||||
if got := hintSelectionRank(HintSource{}, &falseValue); got != selectionRankUnreviewedExplicit {
|
if got := hintSelectionRank(HintSource{}, &falseValue); got != selectionRankUnreviewedExplicit {
|
||||||
t.Fatalf("unreviewed rank = %d", got)
|
t.Fatalf("unreviewed rank = %d", got)
|
||||||
@@ -150,7 +150,7 @@ func TestHintHelperRemainingBranches(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHintParsingAndApplicationConflictEdges(t *testing.T) {
|
func TestCrossPlatformCoverageHintParsingAndApplicationConflictEdges(t *testing.T) {
|
||||||
var product HintProduct
|
var product HintProduct
|
||||||
if err := product.UnmarshalJSON([]byte(`{`)); err == nil {
|
if err := product.UnmarshalJSON([]byte(`{`)); err == nil {
|
||||||
t.Fatal("direct invalid HintProduct succeeded")
|
t.Fatal("direct invalid HintProduct succeeded")
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInterfaceMetadataFailureAndConflictEdges(t *testing.T) {
|
func TestCrossPlatformCoverageInterfaceMetadataFailureAndConflictEdges(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
display := filepath.ToSlash("interface.json")
|
display := filepath.ToSlash("interface.json")
|
||||||
opts := Options{Root: root, InterfaceMetadataPath: "interface.json", ToolPaths: map[string]string{"sample.tool": "sample tool"}}
|
opts := Options{Root: root, InterfaceMetadataPath: "interface.json", ToolPaths: map[string]string{"sample.tool": "sample tool"}}
|
||||||
@@ -53,7 +53,7 @@ func TestInterfaceMetadataFailureAndConflictEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInterfaceSummaryRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageInterfaceSummaryRemainingEdges(t *testing.T) {
|
||||||
if got := summarizeInterfaceDescription("\n\nusable summary", 0); got != "usable summary" {
|
if got := summarizeInterfaceDescription("\n\nusable summary", 0); got != "usable summary" {
|
||||||
t.Fatalf("default max summary = %q", got)
|
t.Fatalf("default max summary = %q", got)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestReviewedSelectionRetentionAndDeliveryFailures(t *testing.T) {
|
func TestCrossPlatformCoverageReviewedSelectionRetentionAndDeliveryFailures(t *testing.T) {
|
||||||
retainReviewedSelectionCandidates(nil)
|
retainReviewedSelectionCandidates(nil)
|
||||||
file := File{
|
file := File{
|
||||||
Products: map[string]ProductMetadata{"sample": {}},
|
Products: map[string]ProductMetadata{"sample": {}},
|
||||||
@@ -74,7 +74,7 @@ func TestReviewedSelectionRetentionAndDeliveryFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpectedCanonicalToolHelpersRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageExpectedCanonicalToolHelpersRemainingEdges(t *testing.T) {
|
||||||
paths := expectedCanonicalToolPaths(Options{CanonicalToolPaths: map[string]string{
|
paths := expectedCanonicalToolPaths(Options{CanonicalToolPaths: map[string]string{
|
||||||
" sample.tool ": " sample item get ",
|
" sample.tool ": " sample item get ",
|
||||||
"": "blank",
|
"": "blank",
|
||||||
@@ -104,7 +104,7 @@ func TestExpectedCanonicalToolHelpersRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSelectionAuthoringLoadFailure(t *testing.T) {
|
func TestCrossPlatformCoverageSelectionAuthoringLoadFailure(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
if err := os.MkdirAll(filepath.Join(root, "hints"), 0o700); err != nil {
|
if err := os.MkdirAll(filepath.Join(root, "hints"), 0o700); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -121,7 +121,7 @@ func TestSelectionAuthoringLoadFailure(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSelectionAuthoringSelectionContractFailure(t *testing.T) {
|
func TestCrossPlatformCoverageSelectionAuthoringSelectionContractFailure(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
writeSelectionFixture(t, root, true, `["dws sample item search --query value"]`)
|
writeSelectionFixture(t, root, true, `["dws sample item search --query value"]`)
|
||||||
path := filepath.Join(root, "internal/cli/schema_hints/selection/sample.json")
|
path := filepath.Join(root, "internal/cli/schema_hints/selection/sample.json")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMetadataMarshalAndProjectionEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataMarshalAndProjectionEdges(t *testing.T) {
|
||||||
bad := map[string]FieldProvenance{"bad": {Value: make(chan int)}}
|
bad := map[string]FieldProvenance{"bad": {Value: make(chan int)}}
|
||||||
if _, err := json.Marshal(ProductMetadata{FieldProvenance: bad}); err == nil {
|
if _, err := json.Marshal(ProductMetadata{FieldProvenance: bad}); err == nil {
|
||||||
t.Fatal("product metadata with unsupported provenance value succeeded")
|
t.Fatal("product metadata with unsupported provenance value succeeded")
|
||||||
@@ -46,7 +46,7 @@ func TestMetadataMarshalAndProjectionEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetadataCandidateAndMergeEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataCandidateAndMergeEdges(t *testing.T) {
|
||||||
seedToolFieldCandidates(nil)
|
seedToolFieldCandidates(nil)
|
||||||
effectiveSelectionScalarRank("", true, selectionRankDefault)
|
effectiveSelectionScalarRank("", true, selectionRankDefault)
|
||||||
effectiveSelectionListRank(nil, true, selectionRankDefault)
|
effectiveSelectionListRank(nil, true, selectionRankDefault)
|
||||||
@@ -117,7 +117,7 @@ func TestMetadataCandidateAndMergeEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetadataConflictAndProvenanceEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataConflictAndProvenanceEdges(t *testing.T) {
|
||||||
conflict := map[string][]FieldCandidateProvenance{
|
conflict := map[string][]FieldCandidateProvenance{
|
||||||
"field": {
|
"field": {
|
||||||
{Value: "b", Source: "same", Precedence: selectionPrecedenceSkill},
|
{Value: "b", Source: "same", Precedence: selectionPrecedenceSkill},
|
||||||
@@ -262,7 +262,7 @@ func TestMetadataConflictAndProvenanceEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetadataSourceAndPathEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataSourceAndPathEdges(t *testing.T) {
|
||||||
if _, _, err := generateFromSources(Options{ProductsDir: "definitely-missing-agentmetadata-products"}); err == nil {
|
if _, _, err := generateFromSources(Options{ProductsDir: "definitely-missing-agentmetadata-products"}); err == nil {
|
||||||
t.Fatal("default-root missing products succeeded")
|
t.Fatal("default-root missing products succeeded")
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ func TestMetadataSourceAndPathEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetadataListAndDispositionEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataListAndDispositionEdges(t *testing.T) {
|
||||||
var values []string
|
var values []string
|
||||||
present := false
|
present := false
|
||||||
rank := 0
|
rank := 0
|
||||||
@@ -428,7 +428,7 @@ func TestMetadataListAndDispositionEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetadataParserConflictEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataParserConflictEdges(t *testing.T) {
|
||||||
out := &File{Products: map[string]ProductMetadata{}, Tools: map[string]ToolMetadata{}}
|
out := &File{Products: map[string]ProductMetadata{}, Tools: map[string]ToolMetadata{}}
|
||||||
parseProductRouting(out, "## 意图判断决策树\n用户提到“empty” → `dws`", "source")
|
parseProductRouting(out, "## 意图判断决策树\n用户提到“empty” → `dws`", "source")
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ func TestMetadataParserConflictEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenerateFromSourcesFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageGenerateFromSourcesFailureEdges(t *testing.T) {
|
||||||
base := func(t *testing.T) (string, Options) {
|
base := func(t *testing.T) (string, Options) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/generator/agentmetadata"
|
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/generator/agentmetadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenerateProductionAgentMetadataPipeline(t *testing.T) {
|
func TestCrossPlatformCoverageGenerateProductionAgentMetadataPipeline(t *testing.T) {
|
||||||
repositoryRoot, err := filepath.Abs(filepath.Join("..", "..", ".."))
|
repositoryRoot, err := filepath.Abs(filepath.Join("..", "..", ".."))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMetadataMainReportsEveryStageFailure(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataMainReportsEveryStageFailure(t *testing.T) {
|
||||||
originalArgs, originalFlags := os.Args, flag.CommandLine
|
originalArgs, originalFlags := os.Args, flag.CommandLine
|
||||||
originalIsolation := validateMetadataIsolation
|
originalIsolation := validateMetadataIsolation
|
||||||
originalAllowlist := validateMetadataAllowlist
|
originalAllowlist := validateMetadataAllowlist
|
||||||
@@ -114,7 +114,7 @@ func TestMetadataMainReportsEveryStageFailure(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetadataWriterFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataWriterFailureEdges(t *testing.T) {
|
||||||
originalMkdir := makeMetadataDirectory
|
originalMkdir := makeMetadataDirectory
|
||||||
originalRead := readMetadataDirectory
|
originalRead := readMetadataDirectory
|
||||||
originalRemove := removeMetadataFile
|
originalRemove := removeMetadataFile
|
||||||
@@ -226,7 +226,7 @@ func TestMetadataWriterFailureEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMetadataRegistryAndSelectionFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageMetadataRegistryAndSelectionFailureEdges(t *testing.T) {
|
||||||
originalRoot := newMetadataRoot
|
originalRoot := newMetadataRoot
|
||||||
originalBuild := buildEffectiveMetadata
|
originalBuild := buildEffectiveMetadata
|
||||||
originalBind := bindEffectiveMetadata
|
originalBind := bindEffectiveMetadata
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMainGeneratesCatalogToTemporaryFile(t *testing.T) {
|
func TestCrossPlatformCoverageMainGeneratesCatalogToTemporaryFile(t *testing.T) {
|
||||||
repositoryRoot, err := filepath.Abs(filepath.Join("..", "..", ".."))
|
repositoryRoot, err := filepath.Abs(filepath.Join("..", "..", ".."))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -31,7 +31,7 @@ func TestMainGeneratesCatalogToTemporaryFile(t *testing.T) {
|
|||||||
main()
|
main()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCatalogMainReportsIsolationAndGenerationFailures(t *testing.T) {
|
func TestCrossPlatformCoverageCatalogMainReportsIsolationAndGenerationFailures(t *testing.T) {
|
||||||
originalArgs, originalFlags := os.Args, flag.CommandLine
|
originalArgs, originalFlags := os.Args, flag.CommandLine
|
||||||
originalValidate := validateCatalogParameterBindings
|
originalValidate := validateCatalogParameterBindings
|
||||||
originalExit := exitCatalogProcess
|
originalExit := exitCatalogProcess
|
||||||
@@ -61,7 +61,7 @@ func TestCatalogMainReportsIsolationAndGenerationFailures(t *testing.T) {
|
|||||||
invoke("-root", repositoryRoot, "-output", filepath.Join(t.TempDir(), "catalog.json"))
|
invoke("-root", repositoryRoot, "-output", filepath.Join(t.TempDir(), "catalog.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenerateSchemaCatalogFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageGenerateSchemaCatalogFailureEdges(t *testing.T) {
|
||||||
originalValidate := validateCatalogParameterBindings
|
originalValidate := validateCatalogParameterBindings
|
||||||
originalSnapshot := buildCatalogSnapshot
|
originalSnapshot := buildCatalogSnapshot
|
||||||
originalMkdir := makeCatalogDirectory
|
originalMkdir := makeCatalogDirectory
|
||||||
@@ -130,7 +130,7 @@ func TestGenerateSchemaCatalogFailureEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenerateSchemaCatalogResolvesBuildExactlyOnce(t *testing.T) {
|
func TestCrossPlatformCoverageGenerateSchemaCatalogResolvesBuildExactlyOnce(t *testing.T) {
|
||||||
root := app.NewRootCommand()
|
root := app.NewRootCommand()
|
||||||
resolveCalls := 0
|
resolveCalls := 0
|
||||||
resolvedRegistryHash := ""
|
resolvedRegistryHash := ""
|
||||||
@@ -165,14 +165,14 @@ func TestGenerateSchemaCatalogResolvesBuildExactlyOnce(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateDeprecatedSurfaceAcceptsEmbeddedRegistrySource(t *testing.T) {
|
func TestCrossPlatformCoverageValidateDeprecatedSurfaceAcceptsEmbeddedRegistrySource(t *testing.T) {
|
||||||
path := filepath.Join("..", "..", "cli", "schema_command_registry.json")
|
path := filepath.Join("..", "..", "cli", "schema_command_registry.json")
|
||||||
if err := validateDeprecatedSurface(path); err != nil {
|
if err := validateDeprecatedSurface(path); err != nil {
|
||||||
t.Fatalf("validateDeprecatedSurface() error = %v", err)
|
t.Fatalf("validateDeprecatedSurface() error = %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateDeprecatedSurfaceRejectsDifferentIdentitySource(t *testing.T) {
|
func TestCrossPlatformCoverageValidateDeprecatedSurfaceRejectsDifferentIdentitySource(t *testing.T) {
|
||||||
sourcePath := filepath.Join("..", "..", "cli", "schema_command_registry.json")
|
sourcePath := filepath.Join("..", "..", "cli", "schema_command_registry.json")
|
||||||
data, err := os.ReadFile(sourcePath)
|
data, err := os.ReadFile(sourcePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -193,13 +193,13 @@ func TestValidateDeprecatedSurfaceRejectsDifferentIdentitySource(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateDeprecatedSurfaceAllowsOmittedCompatibilityFlag(t *testing.T) {
|
func TestCrossPlatformCoverageValidateDeprecatedSurfaceAllowsOmittedCompatibilityFlag(t *testing.T) {
|
||||||
if err := validateDeprecatedSurface(""); err != nil {
|
if err := validateDeprecatedSurface(""); err != nil {
|
||||||
t.Fatalf("validateDeprecatedSurface() error = %v", err)
|
t.Fatalf("validateDeprecatedSurface() error = %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateCatalogOutputIsolationProtectsEveryInputLayer(t *testing.T) {
|
func TestCrossPlatformCoverageValidateCatalogOutputIsolationProtectsEveryInputLayer(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
files := []string{
|
files := []string{
|
||||||
"skills/mono/SKILL.md",
|
"skills/mono/SKILL.md",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMainWritesProductionSmokeRegistry(t *testing.T) {
|
func TestCrossPlatformCoverageMainWritesProductionSmokeRegistry(t *testing.T) {
|
||||||
outputFile, err := os.CreateTemp(t.TempDir(), "schema-registry-smoke-*.json")
|
outputFile, err := os.CreateTemp(t.TempDir(), "schema-registry-smoke-*.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -39,7 +39,7 @@ func TestMainWritesProductionSmokeRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMainReportsSmokeRegistryFailures(t *testing.T) {
|
func TestCrossPlatformCoverageMainReportsSmokeRegistryFailures(t *testing.T) {
|
||||||
originalRoot := newSmokeRoot
|
originalRoot := newSmokeRoot
|
||||||
originalBuild := buildEffectiveSmokeRegistry
|
originalBuild := buildEffectiveSmokeRegistry
|
||||||
originalBind := bindEffectiveSmokeRegistry
|
originalBind := bindEffectiveSmokeRegistry
|
||||||
@@ -100,7 +100,7 @@ func TestMainReportsSmokeRegistryFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildSmokeRegistryIncludesEveryPublicPathDeterministically(t *testing.T) {
|
func TestCrossPlatformCoverageBuildSmokeRegistryIncludesEveryPublicPathDeterministically(t *testing.T) {
|
||||||
registry := cli.EffectiveCommandRegistry{Commands: []cli.CommandSpec{
|
registry := cli.EffectiveCommandRegistry{Commands: []cli.CommandSpec{
|
||||||
{
|
{
|
||||||
CanonicalPath: "internal.hidden",
|
CanonicalPath: "internal.hidden",
|
||||||
@@ -136,7 +136,7 @@ func TestBuildSmokeRegistryIncludesEveryPublicPathDeterministically(t *testing.T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildSmokeRegistryRejectsRegistryWithoutPublicCommands(t *testing.T) {
|
func TestCrossPlatformCoverageBuildSmokeRegistryRejectsRegistryWithoutPublicCommands(t *testing.T) {
|
||||||
_, err := buildSmokeRegistry(cli.EffectiveCommandRegistry{Commands: []cli.CommandSpec{{
|
_, err := buildSmokeRegistry(cli.EffectiveCommandRegistry{Commands: []cli.CommandSpec{{
|
||||||
CanonicalPath: "sample.run",
|
CanonicalPath: "sample.run",
|
||||||
PrimaryCLIPath: "sample run",
|
PrimaryCLIPath: "sample run",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFilesystemSeamFailures(t *testing.T) {
|
func TestCrossPlatformCoverageFilesystemSeamFailures(t *testing.T) {
|
||||||
originalAbs, originalEval, originalRel := guardAbs, guardEvalSymlinks, guardRel
|
originalAbs, originalEval, originalRel := guardAbs, guardEvalSymlinks, guardRel
|
||||||
originalStat, originalWalk := guardStat, guardWalk
|
originalStat, originalWalk := guardStat, guardWalk
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -66,7 +66,7 @@ func TestFilesystemSeamFailures(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateCoverageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageValidateCoverageEdges(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
inputFile := filepath.Join(root, "input.json")
|
inputFile := filepath.Join(root, "input.json")
|
||||||
if err := os.WriteFile(inputFile, []byte("{}"), 0o600); err != nil {
|
if err := os.WriteFile(inputFile, []byte("{}"), 0o600); err != nil {
|
||||||
@@ -148,7 +148,7 @@ func TestValidateCoverageEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateRejectsHardLinkToProtectedDirectoryMember(t *testing.T) {
|
func TestCrossPlatformCoverageValidateRejectsHardLinkToProtectedDirectoryMember(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
protectedDir := filepath.Join(root, "inputs")
|
protectedDir := filepath.Join(root, "inputs")
|
||||||
if err := os.MkdirAll(protectedDir, 0o755); err != nil {
|
if err := os.MkdirAll(protectedDir, 0o755); err != nil {
|
||||||
@@ -171,7 +171,7 @@ func TestValidateRejectsHardLinkToProtectedDirectoryMember(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateRepoTargetAllowlist(t *testing.T) {
|
func TestCrossPlatformCoverageValidateRepoTargetAllowlist(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
allowed := filepath.Join(root, "internal/cli/schema_catalog.json")
|
allowed := filepath.Join(root, "internal/cli/schema_catalog.json")
|
||||||
if err := os.MkdirAll(filepath.Dir(allowed), 0o755); err != nil {
|
if err := os.MkdirAll(filepath.Dir(allowed), 0o755); err != nil {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAgoalUpdateRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAgoalUpdateRemainingCoverage(t *testing.T) {
|
||||||
installScriptedCaller(t, &scriptedToolCaller{dry: true})
|
installScriptedCaller(t, &scriptedToolCaller{dry: true})
|
||||||
if err := executeFilterCoverage(t, newAgoalCommand(),
|
if err := executeFilterCoverage(t, newAgoalCommand(),
|
||||||
"strategy", "update", "--profile-id", "profile", "--content", `[]`, "--request-id", "request",
|
"strategy", "update", "--profile-id", "profile", "--content", `[]`, "--request-id", "request",
|
||||||
@@ -33,7 +33,7 @@ func TestAgoalUpdateRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAgoalLocationFallbackCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAgoalLocationFallbackCoverage(t *testing.T) {
|
||||||
original := agoalLoadLocation
|
original := agoalLoadLocation
|
||||||
agoalLoadLocation = func(string) (*time.Location, error) { return nil, errors.New("zoneinfo unavailable") }
|
agoalLoadLocation = func(string) (*time.Location, error) { return nil, errors.New("zoneinfo unavailable") }
|
||||||
t.Cleanup(func() { agoalLoadLocation = original })
|
t.Cleanup(func() { agoalLoadLocation = original })
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAISearchRemainingFallbackBranches(t *testing.T) {
|
func TestCrossPlatformCoverageAISearchRemainingFallbackBranches(t *testing.T) {
|
||||||
if got := flagValue(&cobra.Command{Use: "empty"}, "missing"); got != "" {
|
if got := flagValue(&cobra.Command{Use: "empty"}, "missing"); got != "" {
|
||||||
t.Fatalf("missing flag=%q", got)
|
t.Fatalf("missing flag=%q", got)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func runAitableCoverageCommand(t *testing.T, caller edition.ToolCaller, args ...
|
|||||||
return root.ExecuteContext(context.Background())
|
return root.ExecuteContext(context.Background())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAitableRetryWrappersExhaustAndRecover(t *testing.T) {
|
func TestCrossPlatformCoverageAitableRetryWrappersExhaustAndRecover(t *testing.T) {
|
||||||
oldDeps, oldSleep := deps, helperSleep
|
oldDeps, oldSleep := deps, helperSleep
|
||||||
t.Cleanup(func() { deps, helperSleep = oldDeps, oldSleep })
|
t.Cleanup(func() { deps, helperSleep = oldDeps, oldSleep })
|
||||||
helperSleep = func(time.Duration) {}
|
helperSleep = func(time.Duration) {}
|
||||||
@@ -88,7 +88,7 @@ func TestAitableRetryWrappersExhaustAndRecover(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAitableCommandValidationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAitableCommandValidationEdges(t *testing.T) {
|
||||||
oldDeps, oldArgs, oldStdin, oldSleep := deps, os.Args, os.Stdin, helperSleep
|
oldDeps, oldArgs, oldStdin, oldSleep := deps, os.Args, os.Stdin, helperSleep
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
deps, os.Args, os.Stdin, helperSleep = oldDeps, oldArgs, oldStdin, oldSleep
|
deps, os.Args, os.Stdin, helperSleep = oldDeps, oldArgs, oldStdin, oldSleep
|
||||||
@@ -189,7 +189,7 @@ func TestAitableCommandValidationEdges(t *testing.T) {
|
|||||||
_ = runAitableCoverageCommand(t, caller, formGet...)
|
_ = runAitableCoverageCommand(t, caller, formGet...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAitableViewCommandEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAitableViewCommandEdges(t *testing.T) {
|
||||||
oldDeps, oldArgs, oldSleep := deps, os.Args, helperSleep
|
oldDeps, oldArgs, oldSleep := deps, os.Args, helperSleep
|
||||||
t.Cleanup(func() { deps, os.Args, helperSleep = oldDeps, oldArgs, oldSleep })
|
t.Cleanup(func() { deps, os.Args, helperSleep = oldDeps, oldArgs, oldSleep })
|
||||||
helperSleep = func(time.Duration) {}
|
helperSleep = func(time.Duration) {}
|
||||||
@@ -263,7 +263,7 @@ func TestAitableViewCommandEdges(t *testing.T) {
|
|||||||
_ = runAitableCoverageCommand(t, &aitableCommandCoverageCaller{err: fmt.Errorf("transport")}, with([]string{"view", "update", "card"}, "--no-cover")...)
|
_ = runAitableCoverageCommand(t, &aitableCommandCoverageCaller{err: fmt.Errorf("transport")}, with([]string{"view", "update", "card"}, "--no-cover")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAitableDeleteCancellationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAitableDeleteCancellationEdges(t *testing.T) {
|
||||||
oldDeps, oldArgs, oldStdin := deps, os.Args, os.Stdin
|
oldDeps, oldArgs, oldStdin := deps, os.Args, os.Stdin
|
||||||
t.Cleanup(func() { deps, os.Args, os.Stdin = oldDeps, oldArgs, oldStdin })
|
t.Cleanup(func() { deps, os.Args, os.Stdin = oldDeps, oldArgs, oldStdin })
|
||||||
os.Args = []string{"dws", "aitable"}
|
os.Args = []string{"dws", "aitable"}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ func installAitableDeps(t *testing.T, caller *aitableTestCaller) *bytes.Buffer {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAitableFlagAndJSONNormalizers(t *testing.T) {
|
func TestCrossPlatformCoverageAitableFlagAndJSONNormalizers(t *testing.T) {
|
||||||
cmd := &cobra.Command{Use: "test"}
|
cmd := &cobra.Command{Use: "test"}
|
||||||
cmd.Flags().String("enabled", "", "")
|
cmd.Flags().String("enabled", "", "")
|
||||||
cmd.Flags().String("records", "", "")
|
cmd.Flags().String("records", "", "")
|
||||||
@@ -152,7 +152,7 @@ func TestAitableFlagAndJSONNormalizers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAitableViewConfigAndHelpers(t *testing.T) {
|
func TestCrossPlatformCoverageAitableViewConfigAndHelpers(t *testing.T) {
|
||||||
config := map[string]any{
|
config := map[string]any{
|
||||||
"filter": map[string]any{"operator": "and", "operands": []any{}},
|
"filter": map[string]any{"operator": "and", "operands": []any{}},
|
||||||
"sort": map[string]any{"fieldId": "f"}, "group": []any{},
|
"sort": map[string]any{"fieldId": "f"}, "group": []any{},
|
||||||
@@ -259,7 +259,7 @@ func TestAitableViewConfigAndHelpers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAitableToolResponseAndPaginationHelpers(t *testing.T) {
|
func TestCrossPlatformCoverageAitableToolResponseAndPaginationHelpers(t *testing.T) {
|
||||||
caller := &aitableTestCaller{responses: []string{`{"data":{"views":[{"viewId":"v","viewType":"Grid"}]}}`}}
|
caller := &aitableTestCaller{responses: []string{`{"data":{"views":[{"viewId":"v","viewType":"Grid"}]}}`}}
|
||||||
installAitableDeps(t, caller)
|
installAitableDeps(t, caller)
|
||||||
view, viewType, err := getViewRaw(context.Background(), "b", "t", "v")
|
view, viewType, err := getViewRaw(context.Background(), "b", "t", "v")
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type atomicErrorReader struct{}
|
|||||||
|
|
||||||
func (atomicErrorReader) Read([]byte) (int, error) { return 0, errors.New("read") }
|
func (atomicErrorReader) Read([]byte) (int, error) { return 0, errors.New("read") }
|
||||||
|
|
||||||
func TestAtomicWriteRemainingFailures(t *testing.T) {
|
func TestCrossPlatformCoverageAtomicWriteRemainingFailures(t *testing.T) {
|
||||||
origMkdir, origCreate := atomicMkdirAll, atomicCreateTemp
|
origMkdir, origCreate := atomicMkdirAll, atomicCreateTemp
|
||||||
origRemove, origRename := atomicRemove, atomicRename
|
origRemove, origRename := atomicRemove, atomicRename
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ func attendanceInput(t *testing.T, text string) *os.File {
|
|||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAttendanceCommandEdgeValidation(t *testing.T) {
|
func TestCrossPlatformCoverageAttendanceCommandEdgeValidation(t *testing.T) {
|
||||||
previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin
|
previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin
|
||||||
os.Args = []string{"dws", "attendance"}
|
os.Args = []string{"dws", "attendance"}
|
||||||
InitDeps(&productExampleCaller{})
|
InitDeps(&productExampleCaller{})
|
||||||
@@ -150,7 +150,7 @@ func TestAttendanceCommandEdgeValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAttendanceConfirmedMutationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAttendanceConfirmedMutationEdges(t *testing.T) {
|
||||||
previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin
|
previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin
|
||||||
os.Args = []string{"dws", "attendance"}
|
os.Args = []string{"dws", "attendance"}
|
||||||
t.Cleanup(func() { deps, os.Args, os.Stdin = previousDeps, previousArgs, previousStdin })
|
t.Cleanup(func() { deps, os.Args, os.Stdin = previousDeps, previousArgs, previousStdin })
|
||||||
@@ -198,7 +198,7 @@ func TestAttendanceConfirmedMutationEdges(t *testing.T) {
|
|||||||
_ = root.Execute()
|
_ = root.Execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAttendanceConfirmedMutationSuccessCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAttendanceConfirmedMutationSuccessCoverage(t *testing.T) {
|
||||||
previousDeps, previousArgs := deps, os.Args
|
previousDeps, previousArgs := deps, os.Args
|
||||||
os.Args = []string{"dws", "attendance"}
|
os.Args = []string{"dws", "attendance"}
|
||||||
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
||||||
@@ -297,7 +297,7 @@ func TestAttendanceConfirmedMutationSuccessCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAttendanceVacationAndScheduleEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAttendanceVacationAndScheduleEdges(t *testing.T) {
|
||||||
previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin
|
previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin
|
||||||
os.Args = []string{"dws", "attendance"}
|
os.Args = []string{"dws", "attendance"}
|
||||||
t.Cleanup(func() { deps, os.Args, os.Stdin = previousDeps, previousArgs, previousStdin })
|
t.Cleanup(func() { deps, os.Args, os.Stdin = previousDeps, previousArgs, previousStdin })
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAttendanceResponseAndDateCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAttendanceResponseAndDateCoverage(t *testing.T) {
|
||||||
previous := deps
|
previous := deps
|
||||||
InitDeps(&productExampleCaller{})
|
InitDeps(&productExampleCaller{})
|
||||||
deps.Out.w = io.Discard
|
deps.Out.w = io.Discard
|
||||||
@@ -42,7 +42,7 @@ func TestAttendanceResponseAndDateCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAttendanceFlagFallbackCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAttendanceFlagFallbackCoverage(t *testing.T) {
|
||||||
newCommand := func() *cobra.Command {
|
newCommand := func() *cobra.Command {
|
||||||
cmd := &cobra.Command{Use: "flags"}
|
cmd := &cobra.Command{Use: "flags"}
|
||||||
cmd.Flags().Int64("primary64", 7, "")
|
cmd.Flags().Int64("primary64", 7, "")
|
||||||
@@ -84,7 +84,7 @@ func TestAttendanceFlagFallbackCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConvertClassCheckTimeCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConvertClassCheckTimeCoverage(t *testing.T) {
|
||||||
class := map[string]any{
|
class := map[string]any{
|
||||||
"sections": []any{
|
"sections": []any{
|
||||||
"bad",
|
"bad",
|
||||||
@@ -115,7 +115,7 @@ func validAttendanceFlagValue(valueType string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSelfSettingSaveCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageSelfSettingSaveCoverage(t *testing.T) {
|
||||||
for _, spec := range selfSettingSaveFlagSpecs {
|
for _, spec := range selfSettingSaveFlagSpecs {
|
||||||
cmd := &cobra.Command{Use: "self"}
|
cmd := &cobra.Command{Use: "self"}
|
||||||
registerSelfSettingSaveFlags(cmd)
|
registerSelfSettingSaveFlags(cmd)
|
||||||
@@ -147,7 +147,7 @@ func TestSelfSettingSaveCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGlobalSettingSaveCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageGlobalSettingSaveCoverage(t *testing.T) {
|
||||||
for _, spec := range globalSettingSaveFlagSpecs {
|
for _, spec := range globalSettingSaveFlagSpecs {
|
||||||
cmd := &cobra.Command{Use: "global"}
|
cmd := &cobra.Command{Use: "global"}
|
||||||
registerGlobalSettingSaveFlags(cmd)
|
registerGlobalSettingSaveFlags(cmd)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCalendarOptionalFlagsRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCalendarOptionalFlagsRemainingCoverage(t *testing.T) {
|
||||||
installScriptedCaller(t, &scriptedToolCaller{dry: true})
|
installScriptedCaller(t, &scriptedToolCaller{dry: true})
|
||||||
start := "2030-01-01T09:00:00+08:00"
|
start := "2030-01-01T09:00:00+08:00"
|
||||||
end := "2030-01-01T10:00:00+08:00"
|
end := "2030-01-01T10:00:00+08:00"
|
||||||
@@ -44,7 +44,7 @@ func TestCalendarOptionalFlagsRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalendarUnknownFlagAndSuggestionRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCalendarUnknownFlagAndSuggestionRemainingCoverage(t *testing.T) {
|
||||||
root := &cobra.Command{Use: "calendar"}
|
root := &cobra.Command{Use: "calendar"}
|
||||||
group := &cobra.Command{Use: "room"}
|
group := &cobra.Command{Use: "room"}
|
||||||
group.SuggestionsMinimumDistance = 3
|
group.SuggestionsMinimumDistance = 3
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func newRecurrenceTestCommand() *cobra.Command {
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalendarMeetingRoomHintCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCalendarMeetingRoomHintCoverage(t *testing.T) {
|
||||||
for _, message := range []string{"plain", "所选组织不支持预定钉钉会议室", `{"errorCode": "400056"}`, `{"errorCode":"400056"}`} {
|
for _, message := range []string{"plain", "所选组织不支持预定钉钉会议室", `{"errorCode": "400056"}`, `{"errorCode":"400056"}`} {
|
||||||
_ = isMeetingRoomDisabledError(message)
|
_ = isMeetingRoomDisabledError(message)
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ func installCalendarCaller(t *testing.T, caller *helpersCoreCaller) {
|
|||||||
t.Cleanup(func() { os.Args = oldArgs })
|
t.Cleanup(func() { os.Args = oldArgs })
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalendarSearchResponseCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCalendarSearchResponseCoverage(t *testing.T) {
|
||||||
caller := &helpersCoreCaller{format: "json", result: textToolResult(`{"result":{"rooms":[]}}`)}
|
caller := &helpersCoreCaller{format: "json", result: textToolResult(`{"result":{"rooms":[]}}`)}
|
||||||
installCalendarCaller(t, caller)
|
installCalendarCaller(t, caller)
|
||||||
cmd := &cobra.Command{Use: "search"}
|
cmd := &cobra.Command{Use: "search"}
|
||||||
@@ -70,7 +70,7 @@ func TestCalendarSearchResponseCoverage(t *testing.T) {
|
|||||||
_ = callMeetingRoomSearchResult(cmd, args, true, true, true)
|
_ = callMeetingRoomSearchResult(cmd, args, true, true, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalendarRangeAttachmentCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCalendarRangeAttachmentCoverage(t *testing.T) {
|
||||||
now := time.Now().UnixMilli()
|
now := time.Now().UnixMilli()
|
||||||
for _, tc := range []struct{ start, end, corrected bool }{
|
for _, tc := range []struct{ start, end, corrected bool }{
|
||||||
{false, false, false}, {false, true, false}, {true, false, false}, {true, true, false}, {true, true, true},
|
{false, false, false}, {false, true, false}, {true, false, false}, {true, true, false}, {true, true, true},
|
||||||
@@ -104,7 +104,7 @@ func TestCalendarRangeAttachmentCoverage(t *testing.T) {
|
|||||||
attachCalendarSearchRange(map[string]any{}, nil, map[string]any{"startTime": now})
|
attachCalendarSearchRange(map[string]any{}, nil, map[string]any{"startTime": now})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalendarBusyAndEventResponseCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCalendarBusyAndEventResponseCoverage(t *testing.T) {
|
||||||
caller := &helpersCoreCaller{format: "json"}
|
caller := &helpersCoreCaller{format: "json"}
|
||||||
installCalendarCaller(t, caller)
|
installCalendarCaller(t, caller)
|
||||||
cmd := &cobra.Command{Use: "events"}
|
cmd := &cobra.Command{Use: "events"}
|
||||||
@@ -142,7 +142,7 @@ func TestCalendarBusyAndEventResponseCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuildRecurrenceCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageBuildRecurrenceCoverage(t *testing.T) {
|
||||||
_ = buildReminders("5,bad,0,10")
|
_ = buildReminders("5,bad,0,10")
|
||||||
if recurrence, err := buildRecurrence(newRecurrenceTestCommand()); err != nil || recurrence != nil {
|
if recurrence, err := buildRecurrence(newRecurrenceTestCommand()); err != nil || recurrence != nil {
|
||||||
t.Fatalf("empty recurrence = %#v, %v", recurrence, err)
|
t.Fatalf("empty recurrence = %#v, %v", recurrence, err)
|
||||||
@@ -173,7 +173,7 @@ func TestBuildRecurrenceCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalendarUnknownFallbackCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageCalendarUnknownFallbackCoverage(t *testing.T) {
|
||||||
root := &cobra.Command{Use: "calendar"}
|
root := &cobra.Command{Use: "calendar"}
|
||||||
group := &cobra.Command{Use: "room", RunE: func(*cobra.Command, []string) error { return errors.New("previous") }}
|
group := &cobra.Command{Use: "room", RunE: func(*cobra.Command, []string) error { return errors.New("previous") }}
|
||||||
known := &cobra.Command{Use: "search", Aliases: []string{"find"}}
|
known := &cobra.Command{Use: "search", Aliases: []string{"find"}}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func runChatCoverageDirect(t *testing.T, path []string, flags map[string]string)
|
|||||||
return command.RunE(command, nil)
|
return command.RunE(command, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatCommandValidationAndSuccessEdges(t *testing.T) {
|
func TestCrossPlatformCoverageChatCommandValidationAndSuccessEdges(t *testing.T) {
|
||||||
previousDeps, previousArgs := deps, os.Args
|
previousDeps, previousArgs := deps, os.Args
|
||||||
os.Args = []string{"dws", "chat"}
|
os.Args = []string{"dws", "chat"}
|
||||||
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
||||||
@@ -107,7 +107,7 @@ func TestChatCommandValidationAndSuccessEdges(t *testing.T) {
|
|||||||
_ = runChatCoverageCommand(t, &scriptedToolCaller{steps: []scriptedToolStep{{text: `{"result":[{"userId":"u1","openDingTalkId":"D1"}]}`}, {text: `{}`}}}, "group-mute-member", "--group=cid", "--users=u1", "--off")
|
_ = runChatCoverageCommand(t, &scriptedToolCaller{steps: []scriptedToolStep{{text: `{"result":[{"userId":"u1","openDingTalkId":"D1"}]}`}, {text: `{}`}}}, "group-mute-member", "--group=cid", "--users=u1", "--off")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatCreateAndMessageSendEdges(t *testing.T) {
|
func TestCrossPlatformCoverageChatCreateAndMessageSendEdges(t *testing.T) {
|
||||||
previousDeps, previousArgs := deps, os.Args
|
previousDeps, previousArgs := deps, os.Args
|
||||||
os.Args = []string{"dws", "chat", "--debug"}
|
os.Args = []string{"dws", "chat", "--debug"}
|
||||||
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
||||||
@@ -160,7 +160,7 @@ func TestChatCreateAndMessageSendEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatWebhookReplyConversationAndDownloadEdges(t *testing.T) {
|
func TestCrossPlatformCoverageChatWebhookReplyConversationAndDownloadEdges(t *testing.T) {
|
||||||
previousDeps, previousArgs := deps, os.Args
|
previousDeps, previousArgs := deps, os.Args
|
||||||
os.Args = []string{"dws", "chat"}
|
os.Args = []string{"dws", "chat"}
|
||||||
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs })
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func newChatFlagTestCommand() *cobra.Command {
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatDirectionAndScalarCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageChatDirectionAndScalarCoverage(t *testing.T) {
|
||||||
search := &cobra.Command{Use: "search"}
|
search := &cobra.Command{Use: "search"}
|
||||||
search.Flags().String("nicks", "", "")
|
search.Flags().String("nicks", "", "")
|
||||||
search.Flags().Int("limit", 20, "")
|
search.Flags().Int("limit", 20, "")
|
||||||
@@ -116,7 +116,7 @@ func TestChatDirectionAndScalarCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatContactMappingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageChatContactMappingCoverage(t *testing.T) {
|
||||||
openIDs := map[string]string{}
|
openIDs := map[string]string{}
|
||||||
names := map[string]string{}
|
names := map[string]string{}
|
||||||
collectContactUserMappings([]any{
|
collectContactUserMappings([]any{
|
||||||
@@ -137,7 +137,7 @@ func TestChatContactMappingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResolveOpenDingTalkIDsCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageResolveOpenDingTalkIDsCoverage(t *testing.T) {
|
||||||
if id, err := resolveOpenDingTalkID(context.Background(), "D-direct"); err != nil || id != "D-direct" {
|
if id, err := resolveOpenDingTalkID(context.Background(), "D-direct"); err != nil || id != "D-direct" {
|
||||||
t.Fatalf("direct ID = %q, %v", id, err)
|
t.Fatalf("direct ID = %q, %v", id, err)
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ func TestResolveOpenDingTalkIDsCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatTargetAndGrantCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageChatTargetAndGrantCoverage(t *testing.T) {
|
||||||
for _, configure := range []func(*cobra.Command){
|
for _, configure := range []func(*cobra.Command){
|
||||||
func(c *cobra.Command) { _ = c.Flags().Set("group", "group") },
|
func(c *cobra.Command) { _ = c.Flags().Set("group", "group") },
|
||||||
func(c *cobra.Command) { _ = c.Flags().Set("open-dingtalk-id", "123") },
|
func(c *cobra.Command) { _ = c.Flags().Set("open-dingtalk-id", "123") },
|
||||||
@@ -277,7 +277,7 @@ func TestChatTargetAndGrantCoverage(t *testing.T) {
|
|||||||
putChatChmodParam(params, "existing", "new")
|
putChatChmodParam(params, "existing", "new")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatFileUtilityCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageChatFileUtilityCoverage(t *testing.T) {
|
||||||
file := filepath.Join(t.TempDir(), "file.txt")
|
file := filepath.Join(t.TempDir(), "file.txt")
|
||||||
if err := os.WriteFile(file, []byte("content"), 0o600); err != nil {
|
if err := os.WriteFile(file, []byte("content"), 0o600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -334,7 +334,7 @@ func TestChatFileUtilityCoverage(t *testing.T) {
|
|||||||
caller.format = "raw"
|
caller.format = "raw"
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUploadConversationLocalFileCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageUploadConversationLocalFileCoverage(t *testing.T) {
|
||||||
oldPut := httpPutFile
|
oldPut := httpPutFile
|
||||||
t.Cleanup(func() { httpPutFile = oldPut })
|
t.Cleanup(func() { httpPutFile = oldPut })
|
||||||
meta := conversationLocalFileMeta{LocalPath: "file", FileName: "file.txt", FileSize: 4, MD5: "md5"}
|
meta := conversationLocalFileMeta{LocalPath: "file", FileName: "file.txt", FileSize: 4, MD5: "md5"}
|
||||||
@@ -358,7 +358,7 @@ func TestUploadConversationLocalFileCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGuardGroupOwnerRemovalCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageGuardGroupOwnerRemovalCoverage(t *testing.T) {
|
||||||
oldArgs := os.Args
|
oldArgs := os.Args
|
||||||
os.Args = []string{"dws", "chat"}
|
os.Args = []string{"dws", "chat"}
|
||||||
t.Cleanup(func() { os.Args = oldArgs })
|
t.Cleanup(func() { os.Args = oldArgs })
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChatMediaUploadCommandRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageChatMediaUploadCommandRemainingCoverage(t *testing.T) {
|
||||||
file := filepath.Join(t.TempDir(), "image.png")
|
file := filepath.Join(t.TempDir(), "image.png")
|
||||||
if err := os.WriteFile(file, []byte("image"), 0o600); err != nil {
|
if err := os.WriteFile(file, []byte("image"), 0o600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -51,7 +51,7 @@ func TestChatMediaUploadCommandRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMediaUploadMultipartWriterRemainingFailures(t *testing.T) {
|
func TestCrossPlatformCoverageMediaUploadMultipartWriterRemainingFailures(t *testing.T) {
|
||||||
file := filepath.Join(t.TempDir(), "image.png")
|
file := filepath.Join(t.TempDir(), "image.png")
|
||||||
if err := os.WriteFile(file, []byte("image"), 0o600); err != nil {
|
if err := os.WriteFile(file, []byte("image"), 0o600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
// every public product command, including leaves that intentionally have no
|
// every public product command, including leaves that intentionally have no
|
||||||
// Example text. It supplies required flags and a small set of positional/flag
|
// Example text. It supplies required flags and a small set of positional/flag
|
||||||
// variants, exercising validation, compatibility aliases, and response parsing.
|
// variants, exercising validation, compatibility aliases, and response parsing.
|
||||||
func TestProductCommandMatrixCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageProductCommandMatrixCoverage(t *testing.T) {
|
||||||
workingDirectory, err := os.Getwd()
|
workingDirectory, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (approvalUnimplementedRunner) Run(_ context.Context, inv executor.Invocatio
|
|||||||
return executor.Result{Invocation: inv}, nil
|
return executor.Result{Invocation: inv}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSheetAuditSinkRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageSheetAuditSinkRemainingEdges(t *testing.T) {
|
||||||
originalSleep := helperSleep
|
originalSleep := helperSleep
|
||||||
helperSleep = func(time.Duration) {}
|
helperSleep = func(time.Duration) {}
|
||||||
defer func() { helperSleep = originalSleep }()
|
defer func() { helperSleep = originalSleep }()
|
||||||
@@ -56,7 +56,7 @@ func TestSheetAuditSinkRemainingEdges(t *testing.T) {
|
|||||||
(&sheetAuditSink{runner: &approvalSequenceRunner{errors: []error{errors.New("permanent")}}}).record(context.Background(), req)
|
(&sheetAuditSink{runner: &approvalSequenceRunner{errors: []error{errors.New("permanent")}}}).record(context.Background(), req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalDecisionAndReplyRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalDecisionAndReplyRemainingEdges(t *testing.T) {
|
||||||
o := &approvalOrchestrator{ownerUserID: "owner", confirmPolicy: "remember", remembered: map[string]bool{"todo.create": false}}
|
o := &approvalOrchestrator{ownerUserID: "owner", confirmPolicy: "remember", remembered: map[string]bool{"todo.create": false}}
|
||||||
if got := o.gateDecision("requester", "todo.create"); got != "reject" {
|
if got := o.gateDecision("requester", "todo.create"); got != "reject" {
|
||||||
t.Fatalf("decision=%q", got)
|
t.Fatalf("decision=%q", got)
|
||||||
@@ -93,7 +93,7 @@ func TestApprovalDecisionAndReplyRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalConcurrentDecisionSeamEdge(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalConcurrentDecisionSeamEdge(t *testing.T) {
|
||||||
original := approvalOwnerDecide
|
original := approvalOwnerDecide
|
||||||
defer func() { approvalOwnerDecide = original }()
|
defer func() { approvalOwnerDecide = original }()
|
||||||
gate := newApprovalGate("")
|
gate := newApprovalGate("")
|
||||||
@@ -106,7 +106,7 @@ func TestApprovalConcurrentDecisionSeamEdge(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalFlushAndExecuteRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalFlushAndExecuteRemainingEdges(t *testing.T) {
|
||||||
gate := newApprovalGate("")
|
gate := newApprovalGate("")
|
||||||
notifier := &fakeNotifier{}
|
notifier := &fakeNotifier{}
|
||||||
o := newTextApprovalOrchestrator(gate, &fakeRunner{}, "owner", notifier)
|
o := newTextApprovalOrchestrator(gate, &fakeRunner{}, "owner", notifier)
|
||||||
@@ -132,7 +132,7 @@ func TestApprovalFlushAndExecuteRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalCardFlowRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalCardFlowRemainingEdges(t *testing.T) {
|
||||||
reply := func(context.Context, string, string) error { return nil }
|
reply := func(context.Context, string, string) error { return nil }
|
||||||
req := ApprovalRequest{Requester: "r", Summary: "x", Action: plannedAction{Product: "todo", Tool: "tool"}}
|
req := ApprovalRequest{Requester: "r", Summary: "x", Action: plannedAction{Product: "todo", Tool: "tool"}}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ func TestApprovalCardFlowRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalCardCallbackRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalCardCallbackRemainingEdges(t *testing.T) {
|
||||||
var nilOrchestrator *approvalOrchestrator
|
var nilOrchestrator *approvalOrchestrator
|
||||||
if _, err := nilOrchestrator.handleCardCallback(context.Background(), nil); err != nil {
|
if _, err := nilOrchestrator.handleCardCallback(context.Background(), nil); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -188,7 +188,7 @@ func TestApprovalCardCallbackRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDingTalkApprovalCardDeliveryFailureEdge(t *testing.T) {
|
func TestCrossPlatformCoverageDingTalkApprovalCardDeliveryFailureEdge(t *testing.T) {
|
||||||
recorder, server := newCardAPIServer(t)
|
recorder, server := newCardAPIServer(t)
|
||||||
withCardAPIBase(t, server.URL)
|
withCardAPIBase(t, server.URL)
|
||||||
recorder.fail["POST /v1.0/card/instances/deliver"] = 500
|
recorder.fail["POST /v1.0/card/instances/deliver"] = 500
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func installApprovalIODefaults(t *testing.T) func() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalGateLookupMutationAndAwaitEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalGateLookupMutationAndAwaitEdges(t *testing.T) {
|
||||||
g := newApprovalGate("")
|
g := newApprovalGate("")
|
||||||
g.setOutTrackID("missing", "track")
|
g.setOutTrackID("missing", "track")
|
||||||
if got := g.findByOutTrackID(" "); got != nil {
|
if got := g.findByOutTrackID(" "); got != nil {
|
||||||
@@ -93,7 +93,7 @@ func TestApprovalGateLookupMutationAndAwaitEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalGatePersistFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalGatePersistFailureEdges(t *testing.T) {
|
||||||
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
||||||
defaults := installApprovalIODefaults(t)
|
defaults := installApprovalIODefaults(t)
|
||||||
g := &approvalGate{clientID: "io"}
|
g := &approvalGate{clientID: "io"}
|
||||||
@@ -129,7 +129,7 @@ func TestApprovalGatePersistFailureEdges(t *testing.T) {
|
|||||||
g.persist(req)
|
g.persist(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalGateLoadRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalGateLoadRemainingEdges(t *testing.T) {
|
||||||
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
t.Setenv("DWS_CONFIG_DIR", t.TempDir())
|
||||||
defaults := installApprovalIODefaults(t)
|
defaults := installApprovalIODefaults(t)
|
||||||
g := &approvalGate{clientID: "load", reqs: make(map[string]*ApprovalRequest), waiters: make(map[string]chan struct{})}
|
g := &approvalGate{clientID: "load", reqs: make(map[string]*ApprovalRequest), waiters: make(map[string]chan struct{})}
|
||||||
@@ -166,7 +166,7 @@ func TestApprovalGateLoadRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApprovalMarkerAndDueRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageApprovalMarkerAndDueRemainingEdges(t *testing.T) {
|
||||||
act, cleaned, found := parseActionMarker(`before [[ACTION:todo.create title='single quoted']] after`)
|
act, cleaned, found := parseActionMarker(`before [[ACTION:todo.create title='single quoted']] after`)
|
||||||
if !found || act.Args["title"] != "single quoted" || strings.Contains(cleaned, "ACTION") {
|
if !found || act.Args["title"] != "single quoted" || strings.Contains(cleaned, "ACTION") {
|
||||||
t.Fatalf("action=%+v cleaned=%q found=%v", act, cleaned, found)
|
t.Fatalf("action=%+v cleaned=%q found=%v", act, cleaned, found)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ func newAtPollForTest(fwd forwarder, extras *connectExtras) *atMentionPoller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtMentionPollerStartAndPollCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAtMentionPollerStartAndPollCoverage(t *testing.T) {
|
||||||
origAfter := helperAfter
|
origAfter := helperAfter
|
||||||
origExecutable := atPollExecutable
|
origExecutable := atPollExecutable
|
||||||
origCommand := atPollCommandContext
|
origCommand := atPollCommandContext
|
||||||
@@ -132,7 +132,7 @@ func TestAtMentionPollerStartAndPollCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtMentionPollerHandleCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAtMentionPollerHandleCoverage(t *testing.T) {
|
||||||
base := atMentionMessage{MsgID: "m", OpenConversationID: "conv", SenderStaffID: "user", SenderNick: "nick", Content: `{"text":"hello"}`, ConversationType: "2"}
|
base := atMentionMessage{MsgID: "m", OpenConversationID: "conv", SenderStaffID: "user", SenderNick: "nick", Content: `{"text":"hello"}`, ConversationType: "2"}
|
||||||
|
|
||||||
p := newAtPollForTest(&atPollSignalForwarder{done: make(chan struct{}, 1)}, &connectExtras{})
|
p := newAtPollForTest(&atPollSignalForwarder{done: make(chan struct{}, 1)}, &connectExtras{})
|
||||||
@@ -198,7 +198,7 @@ func TestAtMentionPollerHandleCoverage(t *testing.T) {
|
|||||||
waitAtPollForward(t, slow)
|
waitAtPollForward(t, slow)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtMentionPollerSendGroupReplyCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAtMentionPollerSendGroupReplyCoverage(t *testing.T) {
|
||||||
origBase := dingtalkCardAPIBase
|
origBase := dingtalkCardAPIBase
|
||||||
t.Cleanup(func() { dingtalkCardAPIBase = origBase })
|
t.Cleanup(func() { dingtalkCardAPIBase = origBase })
|
||||||
p := newAtPollForTest(&atPollSignalForwarder{done: make(chan struct{}, 1)}, &connectExtras{})
|
p := newAtPollForTest(&atPollSignalForwarder{done: make(chan struct{}, 1)}, &connectExtras{})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuildConnectVideoStoryboardEdges(t *testing.T) {
|
func TestCrossPlatformCoverageBuildConnectVideoStoryboardEdges(t *testing.T) {
|
||||||
originalLookPath := connectStoryboardLookPath
|
originalLookPath := connectStoryboardLookPath
|
||||||
originalCommand := connectStoryboardCommand
|
originalCommand := connectStoryboardCommand
|
||||||
originalMkdir := connectStoryboardMkdirAll
|
originalMkdir := connectStoryboardMkdirAll
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/open-dingtalk/dingtalk-stream-sdk-go/chatbot"
|
"github.com/open-dingtalk/dingtalk-stream-sdk-go/chatbot"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAICardAccessTokenRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAICardAccessTokenRemainingEdges(t *testing.T) {
|
||||||
originalBase := dingtalkCardAPIBase
|
originalBase := dingtalkCardAPIBase
|
||||||
defer func() { dingtalkCardAPIBase = originalBase }()
|
defer func() { dingtalkCardAPIBase = originalBase }()
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ func TestAICardAccessTokenRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAICardCallRawAndCheckedRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAICardCallRawAndCheckedRemainingEdges(t *testing.T) {
|
||||||
originalBase := dingtalkCardAPIBase
|
originalBase := dingtalkCardAPIBase
|
||||||
defer func() { dingtalkCardAPIBase = originalBase }()
|
defer func() { dingtalkCardAPIBase = originalBase }()
|
||||||
cached := func() *aiCardClient {
|
cached := func() *aiCardClient {
|
||||||
@@ -99,7 +99,7 @@ func TestAICardCallRawAndCheckedRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAICardDeliveryStreamingAndSleepEdges(t *testing.T) {
|
func TestCrossPlatformCoverageAICardDeliveryStreamingAndSleepEdges(t *testing.T) {
|
||||||
recorder, server := newCardAPIServer(t)
|
recorder, server := newCardAPIServer(t)
|
||||||
withCardAPIBase(t, server.URL)
|
withCardAPIBase(t, server.URL)
|
||||||
c := newAICardClient("client", "secret", defaultAICardTemplateID)
|
c := newAICardClient("client", "secret", defaultAICardTemplateID)
|
||||||
@@ -145,7 +145,7 @@ func TestAICardDeliveryStreamingAndSleepEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCardMarkdownRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCardMarkdownRemainingEdges(t *testing.T) {
|
||||||
table := "intro\n| A | B |\n|---|---|\nend"
|
table := "intro\n| A | B |\n|---|---|\nend"
|
||||||
if got := ensureCardTableBlankLines(table); !strings.Contains(got, "intro\n\n| A") {
|
if got := ensureCardTableBlankLines(table); !strings.Contains(got, "intro\n\n| A") {
|
||||||
t.Fatalf("table normalization=%q", got)
|
t.Fatalf("table normalization=%q", got)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChatRecordParsingAndRecoveryEdges(t *testing.T) {
|
func TestCrossPlatformCoverageChatRecordParsingAndRecoveryEdges(t *testing.T) {
|
||||||
if chatRecordEntries("not-map") != nil {
|
if chatRecordEntries("not-map") != nil {
|
||||||
t.Fatal("chatRecordEntries(non-map) != nil")
|
t.Fatal("chatRecordEntries(non-map) != nil")
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ func TestChatRecordParsingAndRecoveryEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChatRecordDownloadFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageChatRecordDownloadFailureEdges(t *testing.T) {
|
||||||
client := &aiCardClient{httpClient: http.DefaultClient}
|
client := &aiCardClient{httpClient: http.DefaultClient}
|
||||||
if _, err := client.downloadRecoveredChatRecordFileWithCall(context.Background(), fileInboundInfo{}, nil); err == nil {
|
if _, err := client.downloadRecoveredChatRecordFileWithCall(context.Background(), fileInboundInfo{}, nil); err == nil {
|
||||||
t.Fatal("download without locator succeeded")
|
t.Fatal("download without locator succeeded")
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func unitCodexClient(stdin io.WriteCloser, messages ...codexRPCMessage) *codexAp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCodexForwardAppServerFailureAndResumeEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCodexForwardAppServerFailureAndResumeEdges(t *testing.T) {
|
||||||
originalFactory := codexNewAppServerClient
|
originalFactory := codexNewAppServerClient
|
||||||
defer func() { codexNewAppServerClient = originalFactory }()
|
defer func() { codexNewAppServerClient = originalFactory }()
|
||||||
boom := errors.New("factory")
|
boom := errors.New("factory")
|
||||||
@@ -89,7 +89,7 @@ func TestCodexForwardAppServerFailureAndResumeEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCodexCwdConstructorAndReadLoopEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCodexCwdConstructorAndReadLoopEdges(t *testing.T) {
|
||||||
originalAbs := codexAbsPath
|
originalAbs := codexAbsPath
|
||||||
originalExec := codexExecCommandContext
|
originalExec := codexExecCommandContext
|
||||||
defer func() {
|
defer func() {
|
||||||
@@ -130,7 +130,7 @@ func TestCodexCwdConstructorAndReadLoopEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCodexClientSendInitializeAndRequestEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCodexClientSendInitializeAndRequestEdges(t *testing.T) {
|
||||||
if err := unitCodexClient(&codexNthFailWriter{failAt: 1}).initialize(context.Background()); err == nil {
|
if err := unitCodexClient(&codexNthFailWriter{failAt: 1}).initialize(context.Background()); err == nil {
|
||||||
t.Fatal("initialize first send error returned nil")
|
t.Fatal("initialize first send error returned nil")
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ func TestCodexClientSendInitializeAndRequestEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCodexRunTurnRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCodexRunTurnRemainingEdges(t *testing.T) {
|
||||||
serverID := 99
|
serverID := 99
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
name string
|
name string
|
||||||
@@ -185,7 +185,7 @@ func TestCodexRunTurnRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCodexWaitResponseAndNextEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCodexWaitResponseAndNextEdges(t *testing.T) {
|
||||||
serverID, otherID, wantID := 99, 2, 1
|
serverID, otherID, wantID := 99, 2, 1
|
||||||
c := unitCodexClient(&bufferWriteCloser{},
|
c := unitCodexClient(&bufferWriteCloser{},
|
||||||
codexRPCMessage{ID: &serverID, Method: "request/input"},
|
codexRPCMessage{ID: &serverID, Method: "request/input"},
|
||||||
@@ -241,7 +241,7 @@ func TestCodexWaitResponseAndNextEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCodexResultParsingAndDefaultKeyEdges(t *testing.T) {
|
func TestCrossPlatformCoverageCodexResultParsingAndDefaultKeyEdges(t *testing.T) {
|
||||||
if got := codexConvKey(" "); got != "_default" {
|
if got := codexConvKey(" "); got != "_default" {
|
||||||
t.Fatalf("default key=%q", got)
|
t.Fatalf("default key=%q", got)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func (r connectResponseRunner) Run(_ context.Context, invocation executor.Invoca
|
|||||||
return executor.Result{Invocation: invocation, Response: r.response}, r.err
|
return executor.Result{Invocation: invocation, Response: r.response}, r.err
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConnectForwarderPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConnectForwarderPureCoverage(t *testing.T) {
|
||||||
streamSDKLogger{}.Debugf("debug %s", "x")
|
streamSDKLogger{}.Debugf("debug %s", "x")
|
||||||
streamSDKLogger{}.Infof("info %s", "x")
|
streamSDKLogger{}.Infof("info %s", "x")
|
||||||
streamSDKLogger{}.Warningf("warn %s", "x")
|
streamSDKLogger{}.Warningf("warn %s", "x")
|
||||||
@@ -120,7 +120,7 @@ func TestConnectForwarderPureCoverage(t *testing.T) {
|
|||||||
_ = officialChannelGuidance("unknown")
|
_ = officialChannelGuidance("unknown")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGeminiAPIForwarderCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageGeminiAPIForwarderCoverage(t *testing.T) {
|
||||||
t.Setenv("GEMINI_API_KEY", "")
|
t.Setenv("GEMINI_API_KEY", "")
|
||||||
t.Setenv("GOOGLE_API_KEY", "")
|
t.Setenv("GOOGLE_API_KEY", "")
|
||||||
if _, err := newGeminiAPIForwarder(0, connectAgentOptions{}); err == nil {
|
if _, err := newGeminiAPIForwarder(0, connectAgentOptions{}); err == nil {
|
||||||
@@ -159,7 +159,7 @@ func TestGeminiAPIForwarderCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConnectDaemonAndApprovalPureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConnectDaemonAndApprovalPureCoverage(t *testing.T) {
|
||||||
oldOverride := connectDaemonDirOverride
|
oldOverride := connectDaemonDirOverride
|
||||||
connectDaemonDirOverride = t.TempDir()
|
connectDaemonDirOverride = t.TempDir()
|
||||||
t.Cleanup(func() { connectDaemonDirOverride = oldOverride })
|
t.Cleanup(func() { connectDaemonDirOverride = oldOverride })
|
||||||
@@ -222,7 +222,7 @@ func TestConnectDaemonAndApprovalPureCoverage(t *testing.T) {
|
|||||||
_ = orchestrator.decorateForActionDetection("prompt")
|
_ = orchestrator.decorateForActionDetection("prompt")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtPollTextAndCancellationCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageAtPollTextAndCancellationCoverage(t *testing.T) {
|
||||||
for _, tc := range []struct{ content, kind string }{
|
for _, tc := range []struct{ content, kind string }{
|
||||||
{"", "text"},
|
{"", "text"},
|
||||||
{`{"text":" hello "}`, "text"},
|
{`{"text":" hello "}`, "text"},
|
||||||
@@ -244,7 +244,7 @@ func TestAtPollTextAndCancellationCoverage(t *testing.T) {
|
|||||||
_ = json.Unmarshal([]byte(`{"ok":true}`), &payload)
|
_ = json.Unmarshal([]byte(`{"ok":true}`), &payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConnectStreamRemainingPureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageConnectStreamRemainingPureEdges(t *testing.T) {
|
||||||
if convSessionKey(" ") != "_default" || convSessionKey(" conv ") != "conv" {
|
if convSessionKey(" ") != "_default" || convSessionKey(" conv ") != "conv" {
|
||||||
t.Fatal("conversation key normalization failed")
|
t.Fatal("conversation key normalization failed")
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ func TestConnectStreamRemainingPureEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConnectCLIResolutionEdges(t *testing.T) {
|
func TestCrossPlatformCoverageConnectCLIResolutionEdges(t *testing.T) {
|
||||||
clearChannelEnv(t)
|
clearChannelEnv(t)
|
||||||
t.Setenv("DWS_CONNECT_NO_INSTALL", "1")
|
t.Setenv("DWS_CONNECT_NO_INSTALL", "1")
|
||||||
for _, channel := range []string{"openclaw", "hermes", "custom", "unknown"} {
|
for _, channel := range []string{"openclaw", "hermes", "custom", "unknown"} {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ func instantAfter(time.Duration) <-chan time.Time {
|
|||||||
return ch
|
return ch
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStartDaemonLifecycleEdges(t *testing.T) {
|
func TestCrossPlatformCoverageStartDaemonLifecycleEdges(t *testing.T) {
|
||||||
t.Run("unsupported", func(t *testing.T) {
|
t.Run("unsupported", func(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
daemonDetachEnabled = false
|
daemonDetachEnabled = false
|
||||||
@@ -194,7 +194,7 @@ func TestStartDaemonLifecycleEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDaemonFileOperationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonFileOperationEdges(t *testing.T) {
|
||||||
t.Run("default config directory", func(t *testing.T) {
|
t.Run("default config directory", func(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
t.Setenv("HOME", t.TempDir())
|
t.Setenv("HOME", t.TempDir())
|
||||||
@@ -280,7 +280,7 @@ func TestDaemonFileOperationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunSupervisorLifecycleEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunSupervisorLifecycleEdges(t *testing.T) {
|
||||||
t.Run("missing key", func(t *testing.T) {
|
t.Run("missing key", func(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
t.Setenv("DWS_CONNECT_DAEMON_DIRKEY", "")
|
t.Setenv("DWS_CONNECT_DAEMON_DIRKEY", "")
|
||||||
@@ -461,7 +461,7 @@ func TestRunSupervisorLifecycleEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSuperviseWaitForcedKill(t *testing.T) {
|
func TestCrossPlatformCoverageSuperviseWaitForcedKill(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
worker := exec.Command("sh", "-c", "trap '' TERM; sleep 5")
|
worker := exec.Command("sh", "-c", "trap '' TERM; sleep 5")
|
||||||
if err := worker.Start(); err != nil {
|
if err := worker.Start(); err != nil {
|
||||||
@@ -474,7 +474,7 @@ func TestSuperviseWaitForcedKill(t *testing.T) {
|
|||||||
_ = superviseWait(ctx, worker)
|
_ = superviseWait(ctx, worker)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDaemonNotifyStateChangeEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonNotifyStateChangeEdges(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
daemonExecutable = func() (string, error) { return "", errors.New("missing") }
|
daemonExecutable = func() (string, error) { return "", errors.New("missing") }
|
||||||
daemonNotifyStateChange("staff", "custom", "client", "started", "")
|
daemonNotifyStateChange("staff", "custom", "client", "started", "")
|
||||||
@@ -498,7 +498,7 @@ func TestDaemonNotifyStateChangeEdges(t *testing.T) {
|
|||||||
time.Sleep(50 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDaemonStatusAndStopEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonStatusAndStopEdges(t *testing.T) {
|
||||||
t.Run("status directory and corrupt files", func(t *testing.T) {
|
t.Run("status directory and corrupt files", func(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
blocked := filepath.Join(t.TempDir(), "blocked")
|
blocked := filepath.Join(t.TempDir(), "blocked")
|
||||||
@@ -592,7 +592,7 @@ func TestDaemonStatusAndStopEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDaemonStopHookedLifecycleEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonStopHookedLifecycleEdges(t *testing.T) {
|
||||||
const (
|
const (
|
||||||
supervisorPID = 101
|
supervisorPID = 101
|
||||||
workerPID = 202
|
workerPID = 202
|
||||||
@@ -734,7 +734,7 @@ func (r *daemonSequenceRunner) Run(_ context.Context, invocation executor.Invoca
|
|||||||
return executor.Result{Invocation: invocation, Response: response}, nil
|
return executor.Result{Invocation: invocation, Response: response}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDaemonListAndNamePaginationEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonListAndNamePaginationEdges(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
connectDaemonDirOverride = t.TempDir()
|
connectDaemonDirOverride = t.TempDir()
|
||||||
cmd := &cobra.Command{Use: "list"}
|
cmd := &cobra.Command{Use: "list"}
|
||||||
@@ -798,7 +798,7 @@ func TestDaemonListAndNamePaginationEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDaemonControlCommandEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonControlCommandEdges(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
connectDaemonDirOverride = t.TempDir()
|
connectDaemonDirOverride = t.TempDir()
|
||||||
baseDir := connectDaemonDirOverride
|
baseDir := connectDaemonDirOverride
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDaemonUnixStatusAndStopEdges(t *testing.T) {
|
func TestCrossPlatformCoverageDaemonUnixStatusAndStopEdges(t *testing.T) {
|
||||||
t.Run("stale supervisor stops orphan", func(t *testing.T) {
|
t.Run("stale supervisor stops orphan", func(t *testing.T) {
|
||||||
preserveDaemonHooks(t)
|
preserveDaemonHooks(t)
|
||||||
connectDaemonDirOverride = t.TempDir()
|
connectDaemonDirOverride = t.TempDir()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ func geminiResponse(status int, body string, headers map[string]string) *http.Re
|
|||||||
return &http.Response{StatusCode: status, Header: header, Body: io.NopCloser(strings.NewReader(body))}
|
return &http.Response{StatusCode: status, Header: header, Body: io.NopCloser(strings.NewReader(body))}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGeminiAttachmentAndUploadFailureEdges(t *testing.T) {
|
func TestCrossPlatformCoverageGeminiAttachmentAndUploadFailureEdges(t *testing.T) {
|
||||||
f := &geminiAPIForwarder{model: "model", apiKey: "key", baseURL: "https://example.test/v1beta", timeout: time.Second, httpClient: http.DefaultClient}
|
f := &geminiAPIForwarder{model: "model", apiKey: "key", baseURL: "https://example.test/v1beta", timeout: time.Second, httpClient: http.DefaultClient}
|
||||||
parts, err := f.partsWithAttachments(context.Background(), "text", []connectMediaAttachment{{LocalPath: ""}})
|
parts, err := f.partsWithAttachments(context.Background(), "text", []connectMediaAttachment{{LocalPath: ""}})
|
||||||
if err != nil || len(parts) != 1 {
|
if err != nil || len(parts) != 1 {
|
||||||
@@ -108,7 +108,7 @@ func TestGeminiAttachmentAndUploadFailureEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGeminiUploadedFilePollingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageGeminiUploadedFilePollingEdges(t *testing.T) {
|
||||||
originalInterval := geminiFilePollInterval
|
originalInterval := geminiFilePollInterval
|
||||||
t.Cleanup(func() { geminiFilePollInterval = originalInterval })
|
t.Cleanup(func() { geminiFilePollInterval = originalInterval })
|
||||||
f := &geminiAPIForwarder{apiKey: "key", baseURL: "https://example.test/v1beta", httpClient: http.DefaultClient}
|
f := &geminiAPIForwarder{apiKey: "key", baseURL: "https://example.test/v1beta", httpClient: http.DefaultClient}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConnectHealthRemainingIOAndListingBranches(t *testing.T) {
|
func TestCrossPlatformCoverageConnectHealthRemainingIOAndListingBranches(t *testing.T) {
|
||||||
origOverride := connectDaemonDirOverride
|
origOverride := connectDaemonDirOverride
|
||||||
origReadDir := connectHealthReadDir
|
origReadDir := connectHealthReadDir
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestKnowledgeLoadAndAugmentRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageKnowledgeLoadAndAugmentRemainingCoverage(t *testing.T) {
|
||||||
if _, err := loadKnowledgeBase(filepath.Join(t.TempDir(), "missing")); err == nil {
|
if _, err := loadKnowledgeBase(filepath.Join(t.TempDir(), "missing")); err == nil {
|
||||||
t.Fatal("missing knowledge directory returned nil")
|
t.Fatal("missing knowledge directory returned nil")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWikiPullRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageWikiPullRemainingCoverage(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
if _, err := pullWikiDocs(ctx, fakeWikiFetcher{readErrFor: map[string]error{"doc": errors.New("read")}}, knowledgeSource{kind: knowledgeSourceDoc, ref: "doc"}); err == nil {
|
if _, err := pullWikiDocs(ctx, fakeWikiFetcher{readErrFor: map[string]error{"doc": errors.New("read")}}, knowledgeSource{kind: knowledgeSourceDoc, ref: "doc"}); err == nil {
|
||||||
t.Fatal("single doc read error returned nil")
|
t.Fatal("single doc read error returned nil")
|
||||||
@@ -33,7 +33,7 @@ func TestWikiPullRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWikiCacheFailureRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageWikiCacheFailureRemainingCoverage(t *testing.T) {
|
||||||
originalLoad := wikiLoadKnowledgeBase
|
originalLoad := wikiLoadKnowledgeBase
|
||||||
originalRemove := wikiRemoveAll
|
originalRemove := wikiRemoveAll
|
||||||
originalMkdir := wikiMkdirAll
|
originalMkdir := wikiMkdirAll
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func mediaCoverageClient(transport roundTripFunc) *aiCardClient {
|
|||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConnectMediaPureFunctionRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConnectMediaPureFunctionRemainingCoverage(t *testing.T) {
|
||||||
info := parseFileInbound(map[string]interface{}{
|
info := parseFileInbound(map[string]interface{}{
|
||||||
"filePath": " /tmp/file ", "fileType": " text/plain ",
|
"filePath": " /tmp/file ", "fileType": " text/plain ",
|
||||||
"dentryID": int64(1), "spaceID": int(2), "size": json.Number("3"),
|
"dentryID": int64(1), "spaceID": int(2), "size": json.Number("3"),
|
||||||
@@ -63,7 +63,7 @@ func TestConnectMediaPureFunctionRemainingCoverage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDownloadMessageFileRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDownloadMessageFileRemainingCoverage(t *testing.T) {
|
||||||
withCardAPIBase(t, "https://api.test")
|
withCardAPIBase(t, "https://api.test")
|
||||||
boom := errors.New("media failure")
|
boom := errors.New("media failure")
|
||||||
originalMkdir := mediaMkdirAll
|
originalMkdir := mediaMkdirAll
|
||||||
@@ -128,7 +128,7 @@ func TestDownloadMessageFileRemainingCoverage(t *testing.T) {
|
|||||||
mediaCopy = originalCopy
|
mediaCopy = originalCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDentryMediaRemainingCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageDentryMediaRemainingCoverage(t *testing.T) {
|
||||||
withCardAPIBase(t, "https://api.test")
|
withCardAPIBase(t, "https://api.test")
|
||||||
boom := errors.New("dentry failure")
|
boom := errors.New("dentry failure")
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func (r *onboardingCoverageRunner) Run(context.Context, executor.Invocation) (ex
|
|||||||
return executor.Result{}, nil
|
return executor.Result{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConnectOnboardingFailureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConnectOnboardingFailureCoverage(t *testing.T) {
|
||||||
boom := errors.New("onboarding failure")
|
boom := errors.New("onboarding failure")
|
||||||
originalStat := connectStdinStat
|
originalStat := connectStdinStat
|
||||||
originalSleep := connectOnboardingSleep
|
originalSleep := connectOnboardingSleep
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ func opencodeTestClient(t *testing.T, handler http.HandlerFunc) (*opencodeHTTPCl
|
|||||||
return &opencodeHTTPClient{baseURL: server.URL, username: "user", password: "pass", httpClient: server.Client()}, server.Close
|
return &opencodeHTTPClient{baseURL: server.URL, username: "user", password: "pass", httpClient: server.Client()}, server.Close
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpencodeForwarderRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOpencodeForwarderRemainingEdges(t *testing.T) {
|
||||||
t.Run("create session error", func(t *testing.T) {
|
t.Run("create session error", func(t *testing.T) {
|
||||||
client, closeServer := opencodeTestClient(t, func(w http.ResponseWriter, _ *http.Request) { http.Error(w, "failed", http.StatusInternalServerError) })
|
client, closeServer := opencodeTestClient(t, func(w http.ResponseWriter, _ *http.Request) { http.Error(w, "failed", http.StatusInternalServerError) })
|
||||||
defer closeServer()
|
defer closeServer()
|
||||||
@@ -79,7 +79,7 @@ func TestOpencodeForwarderRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpencodeServerEnsureAndCloseEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOpencodeServerEnsureAndCloseEdges(t *testing.T) {
|
||||||
origPort := opencodeFreeLocalPort
|
origPort := opencodeFreeLocalPort
|
||||||
origCommand := opencodeExecCommand
|
origCommand := opencodeExecCommand
|
||||||
origWait := opencodeServerStartupWait
|
origWait := opencodeServerStartupWait
|
||||||
@@ -156,7 +156,7 @@ func TestOpencodeServerEnsureAndCloseEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpencodeWaitHealthyRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOpencodeWaitHealthyRemainingEdges(t *testing.T) {
|
||||||
origWait := opencodeServerStartupWait
|
origWait := opencodeServerStartupWait
|
||||||
origSleep := helperSleep
|
origSleep := helperSleep
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -191,7 +191,7 @@ func TestOpencodeWaitHealthyRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpencodeHTTPClientRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOpencodeHTTPClientRemainingEdges(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
empty := &opencodeHTTPClient{httpClient: &http.Client{}}
|
empty := &opencodeHTTPClient{httpClient: &http.Client{}}
|
||||||
if err := empty.health(ctx); err == nil {
|
if err := empty.health(ctx); err == nil {
|
||||||
@@ -240,7 +240,7 @@ func TestOpencodeHTTPClientRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpencodeDoJSONAndPartsEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOpencodeDoJSONAndPartsEdges(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
client := &opencodeHTTPClient{baseURL: "http://example.invalid", httpClient: &http.Client{}}
|
client := &opencodeHTTPClient{baseURL: "http://example.invalid", httpClient: &http.Client{}}
|
||||||
if err := client.doJSON(ctx, http.MethodPost, "/x", make(chan int), nil); err == nil {
|
if err := client.doJSON(ctx, http.MethodPost, "/x", make(chan int), nil); err == nil {
|
||||||
@@ -297,7 +297,7 @@ func TestOpencodeDoJSONAndPartsEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpencodeSystemHelperEdges(t *testing.T) {
|
func TestCrossPlatformCoverageOpencodeSystemHelperEdges(t *testing.T) {
|
||||||
origPort := opencodeFreeLocalPort
|
origPort := opencodeFreeLocalPort
|
||||||
origRand := opencodeRandRead
|
origRand := opencodeRandRead
|
||||||
origListen := freeLocalPortListen
|
origListen := freeLocalPortListen
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProcessAlivePlatformEdges(t *testing.T) {
|
func TestCrossPlatformCoverageProcessAlivePlatformEdges(t *testing.T) {
|
||||||
if processAlive(0) {
|
if processAlive(0) {
|
||||||
t.Fatal("pid 0 must not be treated as a managed live process")
|
t.Fatal("pid 0 must not be treated as a managed live process")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProcessAliveExitedChildWithRetainedHandle(t *testing.T) {
|
func TestCrossPlatformCoverageProcessAliveExitedChildWithRetainedHandle(t *testing.T) {
|
||||||
child := nativeExitCommand(t)
|
child := nativeExitCommand(t)
|
||||||
if err := child.Start(); err != nil {
|
if err := child.Start(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func installImmediateQoderAfter(t *testing.T) {
|
|||||||
t.Cleanup(func() { helperAfter = orig })
|
t.Cleanup(func() { helperAfter = orig })
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQoderForwardStreamRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageQoderForwardStreamRemainingEdges(t *testing.T) {
|
||||||
installImmediateQoderAfter(t)
|
installImmediateQoderAfter(t)
|
||||||
boom := errors.New("write failed")
|
boom := errors.New("write failed")
|
||||||
f := activeQoderForwarder(qoderErrorWriteCloser{err: boom})
|
f := activeQoderForwarder(qoderErrorWriteCloser{err: boom})
|
||||||
@@ -89,7 +89,7 @@ func TestQoderForwardStreamRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQoderEnsureLockedRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageQoderEnsureLockedRemainingEdges(t *testing.T) {
|
||||||
origExec := qoderExecCommand
|
origExec := qoderExecCommand
|
||||||
origAbs := qoderAbsPath
|
origAbs := qoderAbsPath
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
@@ -149,7 +149,7 @@ func TestQoderEnsureLockedRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQoderInitializeAndIOEdges(t *testing.T) {
|
func TestCrossPlatformCoverageQoderInitializeAndIOEdges(t *testing.T) {
|
||||||
installImmediateQoderAfter(t)
|
installImmediateQoderAfter(t)
|
||||||
origUUID := qoderUUIDString
|
origUUID := qoderUUIDString
|
||||||
qoderUUIDString = func() string { return "fixed" }
|
qoderUUIDString = func() string { return "fixed" }
|
||||||
@@ -226,7 +226,7 @@ func TestQoderInitializeAndIOEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQoderControlAndParseRemainingEdges(t *testing.T) {
|
func TestCrossPlatformCoverageQoderControlAndParseRemainingEdges(t *testing.T) {
|
||||||
f := &qoderStreamForwarder{stdin: &qoderTestWriteCloser{}}
|
f := &qoderStreamForwarder{stdin: &qoderTestWriteCloser{}}
|
||||||
for _, line := range []string{
|
for _, line := range []string{
|
||||||
`{`, `{"type":"other"}`, `{"type":"control_request"}`,
|
`{`, `{"type":"other"}`, `{"type":"control_request"}`,
|
||||||
@@ -273,7 +273,7 @@ func TestQoderControlAndParseRemainingEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQoderCloseAndScanEdges(t *testing.T) {
|
func TestCrossPlatformCoverageQoderCloseAndScanEdges(t *testing.T) {
|
||||||
installImmediateQoderAfter(t)
|
installImmediateQoderAfter(t)
|
||||||
closer := &qoderCloseRecorder{}
|
closer := &qoderCloseRecorder{}
|
||||||
f := &qoderStreamForwarder{stdin: closer, done: make(chan error)}
|
f := &qoderStreamForwarder{stdin: closer, done: make(chan error)}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func (f *failingSessionTempFile) Write(p []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
func (f *failingSessionTempFile) Close() error { return f.closeErr }
|
func (f *failingSessionTempFile) Close() error { return f.closeErr }
|
||||||
|
|
||||||
func TestConnectSessionStoreFailureCoverage(t *testing.T) {
|
func TestCrossPlatformCoverageConnectSessionStoreFailureCoverage(t *testing.T) {
|
||||||
originalRead := connectSessionReadFile
|
originalRead := connectSessionReadFile
|
||||||
originalMkdir := connectSessionMkdirAll
|
originalMkdir := connectSessionMkdirAll
|
||||||
originalCreate := connectSessionCreateTemp
|
originalCreate := connectSessionCreateTemp
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ func runConnectorScenarioWithCard(t *testing.T, messages []*chatbot.BotCallbackD
|
|||||||
return replier, stream
|
return replier, stream
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunStreamConnectorBasicMessageEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunStreamConnectorBasicMessageEdges(t *testing.T) {
|
||||||
t.Run("blank fallback and missing webhook drop", func(t *testing.T) {
|
t.Run("blank fallback and missing webhook drop", func(t *testing.T) {
|
||||||
fwd := &basicConnectorForwarder{reply: "unused"}
|
fwd := &basicConnectorForwarder{reply: "unused"}
|
||||||
blank := connectorMessage("blank", "")
|
blank := connectorMessage("blank", "")
|
||||||
@@ -352,7 +352,7 @@ func TestRunStreamConnectorBasicMessageEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunStreamConnectorForwardAndReplyEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunStreamConnectorForwardAndReplyEdges(t *testing.T) {
|
||||||
t.Run("long markdown and retry success", func(t *testing.T) {
|
t.Run("long markdown and retry success", func(t *testing.T) {
|
||||||
fwd := &basicConnectorForwarder{reply: strings.Repeat("long", 80)}
|
fwd := &basicConnectorForwarder{reply: strings.Repeat("long", 80)}
|
||||||
replier, _ := runConnectorScenario(t, []*chatbot.BotCallbackDataModel{connectorMessage("long", "question")}, fwd, nil, &connectExtras{persona: "Persona"}, []error{errors.New("one"), errors.New("two"), nil}, 3)
|
replier, _ := runConnectorScenario(t, []*chatbot.BotCallbackDataModel{connectorMessage("long", "question")}, fwd, nil, &connectExtras{persona: "Persona"}, []error{errors.New("one"), errors.New("two"), nil}, 3)
|
||||||
@@ -406,7 +406,7 @@ func TestRunStreamConnectorForwardAndReplyEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunStreamConnectorControlAndLifecycleEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunStreamConnectorControlAndLifecycleEdges(t *testing.T) {
|
||||||
t.Run("asynchronous card repair runner", func(t *testing.T) {
|
t.Run("asynchronous card repair runner", func(t *testing.T) {
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
runConnectCardRepair(func() { close(done) })
|
runConnectCardRepair(func() { close(done) })
|
||||||
@@ -532,7 +532,7 @@ func TestRunStreamConnectorControlAndLifecycleEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunStreamConnectorMediaEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunStreamConnectorMediaEdges(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
name string
|
name string
|
||||||
message *chatbot.BotCallbackDataModel
|
message *chatbot.BotCallbackDataModel
|
||||||
@@ -662,7 +662,7 @@ func TestRunStreamConnectorMediaEdges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunStreamConnectorCardEdges(t *testing.T) {
|
func TestCrossPlatformCoverageRunStreamConnectorCardEdges(t *testing.T) {
|
||||||
t.Run("card client without template", func(t *testing.T) {
|
t.Run("card client without template", func(t *testing.T) {
|
||||||
rec, srv := newCardAPIServer(t)
|
rec, srv := newCardAPIServer(t)
|
||||||
withCardAPIBase(t, srv.URL)
|
withCardAPIBase(t, srv.URL)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConnectStreamFinalStatementEdges(t *testing.T) {
|
func TestCrossPlatformCoverageConnectStreamFinalStatementEdges(t *testing.T) {
|
||||||
if got := newConnectMediaClient("client", "secret"); got == nil {
|
if got := newConnectMediaClient("client", "secret"); got == nil {
|
||||||
t.Fatal("default media client is nil")
|
t.Fatal("default media client is nil")
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ func TestConnectStreamFinalStatementEdges(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResolveExecAgentInstallAndForwarderErrors(t *testing.T) {
|
func TestCrossPlatformCoverageResolveExecAgentInstallAndForwarderErrors(t *testing.T) {
|
||||||
clearChannelEnv(t)
|
clearChannelEnv(t)
|
||||||
binDir := t.TempDir()
|
binDir := t.TempDir()
|
||||||
originalPath := os.Getenv("PATH")
|
originalPath := os.Getenv("PATH")
|
||||||
|
|||||||
Loaded 100 of 169 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user