This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: thxCode <[email protected]>
- Loading branch information
1 parent
40dd761
commit d53a6ef
Showing
15 changed files
with
131 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package server | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/seal-io/seal/pkg/bus" | ||
) | ||
|
||
// setupBusSubscribers launches the synchronous subscribers provided by the bus. | ||
func (r *Server) setupBusSubscribers(ctx context.Context, opts initOptions) error { | ||
return bus.Setup(ctx, bus.SetupOptions{ | ||
ModelClient: opts.ModelClient, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package server | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func privateInitiationName(context.Context, initOptions) error { | ||
panic("test only") | ||
} | ||
|
||
func PublicInitiationName(context.Context, initOptions) error { | ||
panic("test only") | ||
} | ||
|
||
type _X struct{} | ||
|
||
func (_X) StructInitiationName(context.Context, initOptions) error { | ||
panic("test only") | ||
} | ||
|
||
func Test_loadInitiationName(t *testing.T) { | ||
anonymityInitiationName := func(context.Context, initOptions) error { | ||
panic("test only") | ||
} | ||
|
||
testCases := []struct { | ||
given initiation | ||
expected string | ||
}{ | ||
{ | ||
given: privateInitiationName, | ||
expected: "private initiation name", | ||
}, | ||
{ | ||
given: PublicInitiationName, | ||
expected: "public initiation name", | ||
}, | ||
{ | ||
given: _X{}.StructInitiationName, | ||
expected: "struct initiation name", | ||
}, | ||
{ | ||
given: anonymityInitiationName, | ||
expected: "func1", | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
t.Run(tc.expected, func(t *testing.T) { | ||
actual := loadInitiationName(tc.given) | ||
assert.Equal(t, tc.expected, actual) | ||
}) | ||
} | ||
} |