mirror of
				https://gitlab.crans.org/nounous/ghostream.git
				synced 2025-11-04 15:42:26 +01:00 
			
		
		
		
	TestHTTPServe was loading templates two times
This commit is contained in:
		@@ -8,15 +8,10 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// TestHTTPServe tries to serve a real HTTP server and load some pages
 | 
					// TestHTTPServe tries to serve a real HTTP server and load some pages
 | 
				
			||||||
func TestHTTPServe(t *testing.T) {
 | 
					func TestHTTPServe(t *testing.T) {
 | 
				
			||||||
	// Load templates
 | 
					 | 
				
			||||||
	if err := loadTemplates(); err != nil {
 | 
					 | 
				
			||||||
		t.Errorf("Failed to load templates: %v", err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	go Serve(nil, nil, &Options{Enabled: true, ListenAddress: "127.0.0.1:8081"})
 | 
						go Serve(nil, nil, &Options{Enabled: true, ListenAddress: "127.0.0.1:8081"})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Sleep 1 second to ensure that the web server is running, to avoid fails because the request came too early
 | 
						// Sleep 500ms to ensure that the web server is running, to avoid fails because the request came too early
 | 
				
			||||||
	time.Sleep(1000000000)
 | 
						time.Sleep(500 * time.Millisecond)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Test GET request
 | 
						// Test GET request
 | 
				
			||||||
	resp, err := http.Get("http://localhost:8081/")
 | 
						resp, err := http.Get("http://localhost:8081/")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user