-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1827 from dedis/work-be1-arnauds5-federation-auth…
…entication_a add be1-go implemention of federation authentication part
- Loading branch information
Showing
28 changed files
with
2,407 additions
and
199 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,112 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"sync" | ||
"testing" | ||
"time" | ||
) | ||
|
||
const waitUp = time.Second * 2 | ||
|
||
func TestConnectMultipleServers(t *testing.T) { | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
wait := sync.WaitGroup{} | ||
|
||
wait.Add(1) | ||
go func() { | ||
defer wait.Done() | ||
|
||
args := []string{os.Args[0], "server", "--pk", "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM=", "serve", "--server-port", "9011", "--client-port", "8010", "--auth-port", "9103"} | ||
t.Logf("running server 1: %v", args) | ||
|
||
run(ctx, args) | ||
t.Log("server 1 done") | ||
}() | ||
|
||
time.Sleep(waitUp) | ||
t.Log("server 1 up") | ||
|
||
wait.Add(1) | ||
go func() { | ||
defer wait.Done() | ||
|
||
args := []string{os.Args[0], "server", "--pk", "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM=", "serve", | ||
"--client-port", "8020", "--server-port", "9003", "--other-servers", "localhost:9011", "--auth-port", "9101"} | ||
t.Logf("running server 2: %v", args) | ||
|
||
run(ctx, args) | ||
t.Log("server 2 done") | ||
}() | ||
|
||
time.Sleep(waitUp) | ||
t.Log("server 2 up") | ||
|
||
wait.Add(1) | ||
go func() { | ||
defer wait.Done() | ||
|
||
args := []string{os.Args[0], "server", "--pk", "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM=", "serve", "--server-port", "9004", "--client-port", "8021", "--other-servers", "localhost:9011", "localhost:9003", "--auth-port", "9102"} | ||
t.Logf("running server 3: %v", args) | ||
|
||
run(ctx, args) | ||
t.Log("server 3 done") | ||
}() | ||
|
||
time.Sleep(waitUp) | ||
t.Log("server 3 up") | ||
|
||
cancel() | ||
wait.Wait() | ||
} | ||
|
||
func TestConnectMultipleServersWithoutPK(t *testing.T) { | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
wait := sync.WaitGroup{} | ||
|
||
wait.Add(1) | ||
go func() { | ||
defer wait.Done() | ||
|
||
args := []string{os.Args[0], "server", "serve", "--server-port", "9011", "--client-port", "8010", "--auth-port", "9101"} | ||
t.Logf("running server 1: %v", args) | ||
|
||
run(ctx, args) | ||
t.Log("server 1 done") | ||
}() | ||
|
||
time.Sleep(waitUp) | ||
t.Log("server 1 up") | ||
|
||
wait.Add(1) | ||
go func() { | ||
defer wait.Done() | ||
|
||
args := []string{os.Args[0], "server", "serve", "--server-port", "9003", "--client-port", "8020", "--other-servers", "localhost:9011", "--auth-port", "9102"} | ||
t.Logf("running server 2: %v", args) | ||
|
||
run(ctx, args) | ||
t.Log("server 2 done") | ||
}() | ||
|
||
time.Sleep(waitUp) | ||
t.Log("server 2 up") | ||
|
||
wait.Add(1) | ||
go func() { | ||
defer wait.Done() | ||
|
||
args := []string{os.Args[0], "server", "serve", "--server-port", "9004", "--client-port", "8021", "--other-servers", "localhost:9011", "localhost:9003", "--auth-port", "9103"} | ||
t.Logf("running server 3: %v", args) | ||
|
||
run(ctx, args) | ||
t.Log("server 3 done") | ||
}() | ||
|
||
time.Sleep(waitUp) | ||
t.Log("server 3 up") | ||
|
||
cancel() | ||
wait.Wait() | ||
} | ||
//import ( | ||
// "context" | ||
// "os" | ||
// "sync" | ||
// "testing" | ||
// "time" | ||
//) | ||
// | ||
//const waitUp = time.Second * 2 | ||
// | ||
//func TestConnectMultipleServers(t *testing.T) { | ||
// ctx, cancel := context.WithCancel(context.Background()) | ||
// wait := sync.WaitGroup{} | ||
// | ||
// wait.Add(1) | ||
// go func() { | ||
// defer wait.Done() | ||
// | ||
// args := []string{os.Args[0], "server", "--pk", "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM=", "serve", "--server-port", "9011", "--client-port", "8010", "--auth-port", "9103"} | ||
// t.Logf("running server 1: %v", args) | ||
// | ||
// run(ctx, args) | ||
// t.Log("server 1 done") | ||
// }() | ||
// | ||
// time.Sleep(waitUp) | ||
// t.Log("server 1 up") | ||
// | ||
// wait.Add(1) | ||
// go func() { | ||
// defer wait.Done() | ||
// | ||
// args := []string{os.Args[0], "server", "--pk", "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM=", "serve", | ||
// "--client-port", "8020", "--server-port", "9003", "--other-servers", "localhost:9011", "--auth-port", "9101"} | ||
// t.Logf("running server 2: %v", args) | ||
// | ||
// run(ctx, args) | ||
// t.Log("server 2 done") | ||
// }() | ||
// | ||
// time.Sleep(waitUp) | ||
// t.Log("server 2 up") | ||
// | ||
// wait.Add(1) | ||
// go func() { | ||
// defer wait.Done() | ||
// | ||
// args := []string{os.Args[0], "server", "--pk", "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM=", "serve", "--server-port", "9004", "--client-port", "8021", "--other-servers", "localhost:9011", "localhost:9003", "--auth-port", "9102"} | ||
// t.Logf("running server 3: %v", args) | ||
// | ||
// run(ctx, args) | ||
// t.Log("server 3 done") | ||
// }() | ||
// | ||
// time.Sleep(waitUp) | ||
// t.Log("server 3 up") | ||
// | ||
// cancel() | ||
// wait.Wait() | ||
//} | ||
// | ||
//func TestConnectMultipleServersWithoutPK(t *testing.T) { | ||
// ctx, cancel := context.WithCancel(context.Background()) | ||
// wait := sync.WaitGroup{} | ||
// | ||
// wait.Add(1) | ||
// go func() { | ||
// defer wait.Done() | ||
// | ||
// args := []string{os.Args[0], "server", "serve", "--server-port", "9011", "--client-port", "8010", "--auth-port", "9101"} | ||
// t.Logf("running server 1: %v", args) | ||
// | ||
// run(ctx, args) | ||
// t.Log("server 1 done") | ||
// }() | ||
// | ||
// time.Sleep(waitUp) | ||
// t.Log("server 1 up") | ||
// | ||
// wait.Add(1) | ||
// go func() { | ||
// defer wait.Done() | ||
// | ||
// args := []string{os.Args[0], "server", "serve", "--server-port", "9003", "--client-port", "8020", "--other-servers", "localhost:9011", "--auth-port", "9102"} | ||
// t.Logf("running server 2: %v", args) | ||
// | ||
// run(ctx, args) | ||
// t.Log("server 2 done") | ||
// }() | ||
// | ||
// time.Sleep(waitUp) | ||
// t.Log("server 2 up") | ||
// | ||
// wait.Add(1) | ||
// go func() { | ||
// defer wait.Done() | ||
// | ||
// args := []string{os.Args[0], "server", "serve", "--server-port", "9004", "--client-port", "8021", "--other-servers", "localhost:9011", "localhost:9003", "--auth-port", "9103"} | ||
// t.Logf("running server 3: %v", args) | ||
// | ||
// run(ctx, args) | ||
// t.Log("server 3 done") | ||
// }() | ||
// | ||
// time.Sleep(waitUp) | ||
// t.Log("server 3 up") | ||
// | ||
// cancel() | ||
// wait.Wait() | ||
//} |
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
96 changes: 95 additions & 1 deletion
96
be1-go/internal/popserver/database/repository/mock_repository.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.