This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Some stupid tests #9
Open
recoilme
wants to merge
2
commits into
VKCOM:master
Choose a base branch
from
recoilme:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package inmem | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
"sync" | ||
"testing" | ||
) | ||
|
||
func TestBuffer(t *testing.T) { | ||
var wg sync.WaitGroup | ||
file := "table1" | ||
const len = 4 | ||
|
||
append := func(i int) { | ||
defer wg.Done() | ||
k := ("Key:" + strconv.Itoa(i)) | ||
err := Write(fmt.Sprintf("%s.%d", file, i%2), []byte(k), true) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
} | ||
for i := 1; i <= len; i++ { | ||
wg.Add(1) | ||
go append(i) | ||
|
||
} | ||
wg.Wait() | ||
//fmt.Println(string(tableBufMap.v["table1.0"].values.b.Bytes())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package main | ||
|
||
//go test -timeout 50s github.com/recoilme/proxyhouse -run Test_Base | ||
/* | ||
func TestBase(t *testing.T) { | ||
//log.SetOutput(ioutil.Discard) //disable log message on test | ||
go main() | ||
|
||
time.Sleep(1 * time.Second) | ||
|
||
addr := ":8124" | ||
//pipeline | ||
|
||
c, err := net.Dial("tcp", addr) | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer c.Close() | ||
fmt.Println("Hello, test") | ||
|
||
lotsa.Output = os.Stdout | ||
lotsa.MemUsage = true | ||
|
||
println("-- bulk --") | ||
N := 10000 | ||
fmt.Printf("\n") | ||
fmt.Printf("go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) | ||
fmt.Printf("\n") | ||
fmt.Printf(" number of cpus: %d\n", runtime.NumCPU()) | ||
fmt.Printf(" number of inserts: %d\n", N) | ||
lotsa.Ops(N, runtime.NumCPU(), func(i, _ int) { | ||
post(fmt.Sprintf("(%d)", i)) | ||
}) | ||
println("done") | ||
|
||
time.Sleep(time.Duration(2) * time.Second) | ||
|
||
} | ||
|
||
func post(b string) { | ||
bod := strings.NewReader(b) | ||
req, err := http.NewRequest("POST", "http://127.0.0.1:8124/?query=INSERT%20INTO%20t%20VALUES", bod) | ||
if err != nil { | ||
panic(err) | ||
} | ||
resp, err := http.DefaultClient.Do(req) | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer resp.Body.Close() | ||
_, err = ioutil.ReadAll(resp.Body) | ||
|
||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
*/ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use another name for func. It is not recommended to use
go
reserved names