You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/08/11 22:33:03 UTC

[GitHub] [trafficcontrol] rob05c commented on a change in pull request #6099: Add/Update/Correct GoDoc comments on /lib symbols

rob05c commented on a change in pull request #6099:
URL: https://github.com/apache/trafficcontrol/pull/6099#discussion_r687239420



##########
File path: lib/go-atscfg/atsdotrules.go
##########
@@ -37,6 +51,12 @@ type ATSDotRulesOpts struct {
 	HdrComment string
 }
 
+// MakeATSDotRules constructs a '50-ats.rules' file for the given server with
+// the given parameters and header comment content.
+//
+// WARNING: this will panic if parameters with the Names 'Drive_Prefix',

Review comment:
       This isn't true. It generates fine if any or all params are missing.
   
   ```
   func TestMakeATSDotRulesNoFiles(t *testing.T) {
   	server := makeGenericServer()
   	serverProfile := "myProfile"
   	server.Profile = &serverProfile
   
   	hdr := "myHeaderComment"
   
   	serverParams := []tc.Parameter{}
   
   	cfg, err := MakeATSDotRules(server, serverParams, &ATSDotRulesOpts{HdrComment: hdr})
   	if err != nil {
   		t.Fatal(err)
   	}
   	txt := cfg.Text
   
   	testComment(t, txt, hdr)
   
   	if count := strings.Count(txt, "\n"); count != 1 { // one line for each drive letter, plus 1 comment
   		t.Errorf("expected one line for a comment and no others (with no parameters), actual: '%v' count %v", txt, count)
   	}
   }
   ```
   
   ```
   $ go test -failfast -v -run TestMakeATSDotRulesNoFiles
   === RUN   TestMakeATSDotRulesNoFiles
   --- PASS: TestMakeATSDotRulesNoFiles (0.00s)
   PASS
   ok      github.com/apache/trafficcontrol/lib/go-atscfg  0.487s
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org