Browse Source

fixed fortune test to work alongside db changes. Note that the fortuen test does not use the new db changes

Patrick Falls 12 years ago
parent
commit
7ae79af08e
4 changed files with 12 additions and 7 deletions
  1. 1 1
      benchmarker.py
  2. 2 2
      go/README.md
  3. 7 2
      go/src/hello/hello.go
  4. 2 2
      webgo/README.md

+ 1 - 1
benchmarker.py

@@ -306,7 +306,7 @@ class Benchmarker:
         continue
         continue
       
       
       # If the test does not contain an implementation of the current test-type, skip it
       # If the test does not contain an implementation of the current test-type, skip it
-      if not test.contains_type(self.type):
+      if self.type != 'all' and not test.contains_type(self.type):
         continue
         continue
       
       
       print textwrap.dedent("""
       print textwrap.dedent("""

+ 2 - 2
go/README.md

@@ -7,10 +7,10 @@ This is the go portion of a [benchmarking test suite](../) comparing a variety o
 
 
 ## Versions
 ## Versions
 
 
-* [Go 1.0.3](http://golang.org/)
+* [Go 1.1beta2](http://golang.org/)
 
 
 ## Test URLs
 ## Test URLs
 
 
 ### JSON Encoding Test
 ### JSON Encoding Test
 
 
-http://localhost:8080/json
+http://localhost:8080/json

+ 7 - 2
go/src/hello/hello.go

@@ -37,6 +37,7 @@ const (
 
 
 var (
 var (
 	stmts = make(chan *sql.Stmt, MAX_CON)
 	stmts = make(chan *sql.Stmt, MAX_CON)
+	fortuneDB *sql.DB
 )
 )
 
 
 func jsonHandler(w http.ResponseWriter, r *http.Request) {
 func jsonHandler(w http.ResponseWriter, r *http.Request) {
@@ -71,7 +72,7 @@ func fortuneHandler(w http.ResponseWriter, r *http.Request) {
 	fortunes := make([]Fortune, 13)
 	fortunes := make([]Fortune, 13)
   
   
 	// Execute the query
 	// Execute the query
-	rows, err := db.Query(DB_FORTUNE_SELECT_SQL)
+	rows, err := fortuneDB.Query(DB_FORTUNE_SELECT_SQL)
 	if err != nil {
 	if err != nil {
 		log.Fatalf("Error preparing statement: %s", err)
 		log.Fatalf("Error preparing statement: %s", err)
 	}
 	}
@@ -102,9 +103,13 @@ type ByMessage struct{ Fortunes }
 func (s ByMessage) Less(i, j int) bool { return s.Fortunes[i].Message < s.Fortunes[j].Message }
 func (s ByMessage) Less(i, j int) bool { return s.Fortunes[i].Message < s.Fortunes[j].Message }
 
 
 func main() {
 func main() {
+	var err error
+	if fortuneDB, err = sql.Open("mysql", DB_CONN_STR); err != nil {
+	    log.Fatalf("Error opening database: %s", err)
+	} 
 	http.HandleFunc("/db", dbHandler)
 	http.HandleFunc("/db", dbHandler)
 	http.HandleFunc("/json", jsonHandler)
 	http.HandleFunc("/json", jsonHandler)
-  http.HandleFunc("/fortune", fortuneHandler)
+	http.HandleFunc("/fortune", fortuneHandler)
 	http.ListenAndServe(":8080", nil)
 	http.ListenAndServe(":8080", nil)
 }
 }
 
 

+ 2 - 2
webgo/README.md

@@ -7,11 +7,11 @@ This is the webgo portion of a [benchmarking test suite](../) comparing a variet
 
 
 ## Versions
 ## Versions
 
 
-* [Go 1.0.3](http://golang.org/)
+* [Go 1.1beta2](http://golang.org/)
 * [WebGo](https://github.com/hoisie/web)
 * [WebGo](https://github.com/hoisie/web)
 
 
 ## Test URLs
 ## Test URLs
 
 
 ### JSON Encoding Test
 ### JSON Encoding Test
 
 
-    http://localhost:8080/json
+    http://localhost:8080/json