Enhance Integration Tests with Cache Verification

- Added assertions in multiple integration tests to verify that robots are correctly loaded into the cache during various execution scenarios.
- Updated tests for clock triggers, concurrent executions, control tests, event triggers, and human interventions to ensure comprehensive coverage of cache functionality.
- Improved test reliability by confirming the presence of expected robots in the cache, enhancing overall test robustness.
This commit is contained in:
Max 2026-01-15 17:39:03 +08:00
parent 237f193e9e
commit 00851c442e
5 changed files with 23 additions and 0 deletions

View file

@ -52,6 +52,10 @@ func TestIntegrationClockTimesMode(t *testing.T) {
require.NoError(t, err)
defer m.Stop()
// Verify robot is loaded into cache
robot := m.Cache().Get("robot_integ_clock_times1")
require.NotNil(t, robot, "Robot should be loaded into cache")
m.Executor().Reset()
// Trigger at 09:00 on Wednesday

View file

@ -76,6 +76,13 @@ func TestIntegrationConcurrentExecution(t *testing.T) {
require.NoError(t, err)
defer m.Stop()
// Verify robots are loaded into cache
for i := 0; i < 5; i++ {
memberID := "robot_integ_conc_multi_" + string(rune('A'+i))
robot := m.Cache().Get(memberID)
require.NotNil(t, robot, "Robot %s should be loaded into cache", memberID)
}
ctx := types.NewContext(context.Background(), nil)
// Trigger all robots simultaneously

View file

@ -53,6 +53,10 @@ func TestIntegrationExecutionPauseResume(t *testing.T) {
require.NoError(t, err)
defer m.Stop()
// Verify robot is loaded into cache
robot := m.Cache().Get("robot_integ_ctrl_pause")
require.NotNil(t, robot, "Robot should be loaded into cache")
ctx := types.NewContext(context.Background(), nil)
// Trigger execution

View file

@ -46,6 +46,10 @@ func TestIntegrationEventTrigger(t *testing.T) {
require.NoError(t, err)
defer m.Stop()
// Verify robot is loaded into cache
robot := m.Cache().Get("robot_integ_event_webhook")
require.NotNil(t, robot, "Robot should be loaded into cache")
ctx := types.NewContext(context.Background(), nil)
req := &types.EventRequest{
MemberID: "robot_integ_event_webhook",

View file

@ -47,6 +47,10 @@ func TestIntegrationHumanIntervention(t *testing.T) {
require.NoError(t, err)
defer m.Stop()
// Verify robot is loaded into cache
robot := m.Cache().Get("robot_integ_human_add")
require.NotNil(t, robot, "Robot should be loaded into cache")
ctx := types.NewContext(context.Background(), nil)
req := &types.InterveneRequest{
TeamID: "team_integ_human",