mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			660 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			660 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package stats
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
	"time"
 | 
						|
 | 
						|
	_ "github.com/go-sql-driver/mysql"
 | 
						|
	"github.com/iwind/TeaGo/dbs"
 | 
						|
	timeutil "github.com/iwind/TeaGo/utils/time"
 | 
						|
)
 | 
						|
 | 
						|
func TestTrafficDailyStatDAO_IncreaseDayBytes(t *testing.T) {
 | 
						|
	dbs.NotifyReady()
 | 
						|
 | 
						|
	var now = time.Now()
 | 
						|
	err := SharedTrafficDailyStatDAO.IncreaseDailyStat(nil, timeutil.Format("Ymd"), 1, 1, 1, 1, 1, 1)
 | 
						|
	if err != nil {
 | 
						|
		t.Fatal(err)
 | 
						|
	}
 | 
						|
	t.Log("ok", time.Since(now).Seconds()*1000, "ms")
 | 
						|
}
 | 
						|
 | 
						|
func TestTrafficDailyStatDAO_IncreaseIPs(t *testing.T) {
 | 
						|
	dbs.NotifyReady()
 | 
						|
 | 
						|
	var tx *dbs.Tx
 | 
						|
	err := SharedTrafficDailyStatDAO.IncreaseIPs(tx, timeutil.Format("Ymd"), 123)
 | 
						|
	if err != nil {
 | 
						|
		t.Fatal(err)
 | 
						|
	}
 | 
						|
}
 |