Просмотр исходного кода

Add GitHub Actions tests; govet and gofmt fixes

Rod Hynes 7 месяцев назад
Родитель
Сommit
57f1da5409
2 измененных файлов с 11 добавлено и 3 удалено
  1. 2 0
      .github/workflows/tests.yml
  2. 9 3
      psiphon/common/dsl/dsl_test.go

+ 2 - 0
.github/workflows/tests.yml

@@ -79,6 +79,7 @@ jobs:
           go test -v -race ./psiphon/common
           go test -v -race ./psiphon/common/accesscontrol
           go test -v -race ./psiphon/common/crypto/ssh
+          go test -v -race ./psiphon/common/dsl
           go test -v -race ./psiphon/common/fragmentor
           go test -v -race -tags "PSIPHON_ENABLE_INPROXY" ./psiphon/common/inproxy
           go test -v -race ./psiphon/common/regen
@@ -114,6 +115,7 @@ jobs:
           go test -v -covermode=count -coverprofile=accesscontrol.coverprofile ./psiphon/common/accesscontrol
           go test -v -covermode=count -coverprofile=ssh.coverprofile ./psiphon/common/crypto/ssh
           go test -v -covermode=count -coverprofile=fragmentor.coverprofile ./psiphon/common/fragmentor
+          go test -v -covermode=count -coverprofile=dsl.coverprofile ./psiphon/common/dsl
           go test -v -covermode=count -tags "PSIPHON_ENABLE_INPROXY" -coverprofile=inproxy.coverprofile ./psiphon/common/inproxy
           go test -v -covermode=count -coverprofile=regen.coverprofile ./psiphon/common/regen
           go test -v -covermode=count -coverprofile=monotime.coverprofile ./psiphon/common/monotime

+ 9 - 3
psiphon/common/dsl/dsl_test.go

@@ -121,7 +121,13 @@ func TestDSLs(t *testing.T) {
 }
 
 var testClientIP = "192.168.0.1"
-var testClientGeoIPData = common.GeoIPData{"Country", "City", "ISP", "ASN", "ASO"}
+var testClientGeoIPData = common.GeoIPData{
+	Country: "Country",
+	City:    "City",
+	ISP:     "ISP",
+	ASN:     "ASN",
+	ASO:     "ASO",
+}
 
 func testDSLs(testConfig *testConfig) error {
 
@@ -457,7 +463,7 @@ func (c *dslClient) DatastoreKnownOSLIDs() ([]OSLID, error) {
 	defer c.mutex.Unlock()
 
 	var IDs []OSLID
-	for IDStr, _ := range c.oslStates {
+	for IDStr := range c.oslStates {
 		ID, _ := hex.DecodeString(IDStr)
 		IDs = append(IDs, ID)
 	}
@@ -749,7 +755,7 @@ func (b *dslBackend) handleDiscoverServerEntries(cborRequest []byte) ([]byte, er
 	if !missingOSLs {
 
 		count := 0
-		for tag, _ := range b.serverEntries {
+		for tag := range b.serverEntries {
 			if count >= int(request.DiscoverCount) {
 				break
 			}