Merge branch 'develop' of https://gitclone.com/github.com/beego/beego into session-filter
This commit is contained in:
		
						commit
						89d5b4741f
					
				
							
								
								
									
										2
									
								
								.github/workflows/changelog.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/changelog.yml
									
									
									
									
										vendored
									
									
								
							| @ -8,7 +8,7 @@ on: | |||||||
|   pull_request: |   pull_request: | ||||||
|     types: [opened, synchronize, reopened, labeled, unlabeled] |     types: [opened, synchronize, reopened, labeled, unlabeled] | ||||||
|     branches: |     branches: | ||||||
|       - master |       - develop | ||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|   changelog: |   changelog: | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| # developing | # developing | ||||||
|  | - Update changlog.yml to check every PR to develop branch.[4427](https://github.com/beego/beego/pull/4427) | ||||||
| - Fix 4396: Add context.param module into adapter. [4398](https://github.com/beego/beego/pull/4398) | - Fix 4396: Add context.param module into adapter. [4398](https://github.com/beego/beego/pull/4398) | ||||||
| - Remove `duration` from prometheus labels. [4391](https://github.com/beego/beego/pull/4391) | - Remove `duration` from prometheus labels. [4391](https://github.com/beego/beego/pull/4391) | ||||||
| - Fix `unknown escape sequence` in generated code. [4385](https://github.com/beego/beego/pull/4385) | - Fix `unknown escape sequence` in generated code. [4385](https://github.com/beego/beego/pull/4385) | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ import ( | |||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"net/http/httptest" | 	"net/http/httptest" | ||||||
| 	"testing" | 	"testing" | ||||||
|  | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"github.com/stretchr/testify/assert" | 	"github.com/stretchr/testify/assert" | ||||||
| 
 | 
 | ||||||
| @ -37,4 +38,5 @@ func TestFilterChain(t *testing.T) { | |||||||
| 	ctx.Input.SetData("RouterPattern", "my-route") | 	ctx.Input.SetData("RouterPattern", "my-route") | ||||||
| 	filter(ctx) | 	filter(ctx) | ||||||
| 	assert.True(t, ctx.Input.GetData("invocation").(bool)) | 	assert.True(t, ctx.Input.GetData("invocation").(bool)) | ||||||
|  | 	time.Sleep(1 * time.Second) | ||||||
| } | } | ||||||
|  | |||||||
| @ -109,6 +109,23 @@ func TestTask_Run(t *testing.T) { | |||||||
| 	assert.Equal(t, "Hello, world! 101", l[1].errinfo) | 	assert.Equal(t, "Hello, world! 101", l[1].errinfo) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func TestCrudTask(t *testing.T) { | ||||||
|  | 	m := newTaskManager() | ||||||
|  | 	m.AddTask("my-task1", NewTask("my-task1", "0/30 * * * * *", func(ctx context.Context) error { | ||||||
|  | 		return nil | ||||||
|  | 	})) | ||||||
|  | 
 | ||||||
|  | 	m.AddTask("my-task2", NewTask("my-task2", "0/30 * * * * *", func(ctx context.Context) error { | ||||||
|  | 		return nil | ||||||
|  | 	})) | ||||||
|  | 
 | ||||||
|  | 	m.DeleteTask("my-task1") | ||||||
|  | 	assert.Equal(t, 1, len(m.adminTaskList)) | ||||||
|  | 
 | ||||||
|  | 	m.ClearTask() | ||||||
|  | 	assert.Equal(t, 0, len(m.adminTaskList)) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func wait(wg *sync.WaitGroup) chan bool { | func wait(wg *sync.WaitGroup) chan bool { | ||||||
| 	ch := make(chan bool) | 	ch := make(chan bool) | ||||||
| 	go func() { | 	go func() { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user