Commit cdd88546 authored by pfandzelter's avatar pfandzelter
Browse files

Update go version and Dockerfiles

parent 8b23c011
# building the binary
FROM golang:1.15-alpine as golang
FROM golang:1.16-alpine as golang
LABEL maintainer="tp@mcc.tu-berlin.de"
......@@ -32,4 +32,4 @@ EXPOSE 443
EXPOSE 5555
ENV PATH=.
CMD ["fred"]
\ No newline at end of file
ENTRYPOINT ["fred"]
......@@ -478,7 +478,7 @@ For development, it is recommended to install [GoLand](https://www.jetbrains.com
### Git Workflow
Setup git environment with `sh ./ci/env-setup.sh` (installs git hooks). Be sure to have Go (>1.15) installed.
Setup git environment with `sh ./ci/env-setup.sh` (installs git hooks). Be sure to have Go (>1.16) installed.
The `main` branch is protected and only approved pull requests can push to it.
Most important part of the workflow is `rebase`, [here's](https://www.atlassian.com/git/tutorials/merging-vs-rebasing) a refresher on merging vs rebasing.
......
# building the binary
FROM golang:1.15-alpine as golang
FROM golang:1.16-alpine as golang
LABEL maintainer="tp@mcc.tu-berlin.de"
......@@ -32,4 +32,4 @@ EXPOSE 443
EXPOSE 10000
ENV PATH=.
ENTRYPOINT ["alexandra"]
\ No newline at end of file
ENTRYPOINT ["alexandra"]
# This is a compy from the dockerfile that adds support for debugging. It is used in the 3NodeTest to debug nodeB
# building the binary
FROM golang:1.15-buster as golang
FROM golang:1.16-buster as golang
LABEL maintainer="tp@mcc.tu-berlin.de"
......@@ -36,5 +36,5 @@ EXPOSE 443
EXPOSE 5555
EXPOSE 40000
#ENTRYPOINT ["/dlv"]
ENTRYPOINT ["./dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "./frednode", "--"]
\ No newline at end of file
ENTRYPOINT ["./dlv"]
CMD ["--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "./frednode", "--"]
......@@ -60,7 +60,7 @@ func (n *NameService) getPrefix(prefix string) (kv map[string]string, err error)
if ev.IsModify() {
if ev.Type == mvccpb.DELETE {
n.local.Del(prefix)
log.Debug().Msgf("prefix: %s cache invalidation", prefix)
log.Debug().Msgf("prefix: %s remote cache invalidation", prefix)
return
}
}
......@@ -117,7 +117,7 @@ func (n *NameService) getExact(key string) (v string, err error) {
if ev.IsModify() {
if ev.Type == mvccpb.DELETE {
n.local.Del(key)
log.Debug().Msgf("key: %s cache invalidation", key)
log.Debug().Msgf("key: %s remote cache invalidation", key)
return
}
}
......@@ -159,7 +159,7 @@ func (n *NameService) put(key, value string) (err error) {
if n.cached {
n.local.Del(key)
log.Debug().Msgf("key: %s cache invalidation", key)
log.Debug().Msgf("key: %s local cache invalidation", key)
}
......@@ -180,7 +180,7 @@ func (n *NameService) delete(key string) (err error) {
if n.cached {
n.local.Del(key)
log.Debug().Msgf("key: %s cache invalidation", key)
log.Debug().Msgf("key: %s local cache invalidation", key)
}
......
# Shamelessly stolen from the original dockerfile
# building the binary
FROM golang:1.15-alpine as golang
FROM golang:1.16-alpine as golang
LABEL maintainer="tp@mcc.tu-berlin.de"
......@@ -31,4 +31,4 @@ COPY --from=golang /go/bin/storageserver storageserver
EXPOSE 1337
ENV PATH=.
ENTRYPOINT ["storageserver"]
\ No newline at end of file
ENTRYPOINT ["storageserver"]
# Shamelessly stolen from the original dockerfile
# building the binary
FROM golang:1.15-alpine
FROM golang:1.16-alpine
LABEL maintainer="tp@mcc.tu-berlin.de"
......@@ -22,4 +22,4 @@ COPY proto proto
RUN go install ./tests/3NodeTest/cmd/main/
ENTRYPOINT ["/go/bin/main"]
\ No newline at end of file
ENTRYPOINT ["/go/bin/main"]
......@@ -4,6 +4,10 @@ type AuthenticationSuite struct {
c *Config
}
func (t *AuthenticationSuite) Name() string {
return "Authentication"
}
func (t *AuthenticationSuite) RunTests() {
// test RBAC and authentication
logNodeAction(t.c.nodeA, "create keygroup \"rbactest\"")
......
......@@ -173,6 +173,10 @@ func concurrentUpdatesImmutable(nodes []*grpcclient.Node, concurrent int, update
}
}
func (t *ConcurrencySuite) Name() string {
return "Concurrency"
}
func (t *ConcurrencySuite) RunTests() {
run := 0
// Test 1: create a keygroup on a node, have it updated by two concurrent goroutines
......
......@@ -8,6 +8,10 @@ type ExpirySuite struct {
c *Config
}
func (t *ExpirySuite) Name() string {
return "Expiry"
}
func (t *ExpirySuite) RunTests() {
// test expiring data items
logNodeAction(t.c.nodeC, "Create normal keygroup on nodeC without expiry")
......
......@@ -4,6 +4,10 @@ type ImmutableSuite struct {
c *Config
}
func (t *ImmutableSuite) Name() string {
return "Immutable"
}
func (t *ImmutableSuite) RunTests() {
// testing immutable keygroups
logNodeAction(t.c.nodeB, "Testing immutable keygroups by creating a new immutable keygroup on nodeB")
......
......@@ -16,8 +16,11 @@ import (
var (
// Wait for the user to press enter to continue
waitUser *bool
reader = bufio.NewReader(os.Stdin)
waitUser *bool
waitTime *time.Duration
reader = bufio.NewReader(os.Stdin)
currSuite int
failures map[int]int
)
func main() {
......@@ -32,6 +35,7 @@ func main() {
// Parse Flags
waitUser = flag.Bool("wait-user", false, "wait for user input after each test")
waitTime = flag.Duration("wait-time", 1*time.Millisecond, "time to wait between commands")
nodeAhost := flag.String("nodeAhost", "", "host of nodeA (e.g. localhost)") // Docker: localhost
nodeAhttpPort := flag.String("nodeAhttp", "", "port of nodeA (e.g. 9001)") // Docker: 9002
......@@ -136,19 +140,32 @@ func main() {
minTest = maxTest
}
failures = make(map[int]int)
startTime := time.Now()
// run tests
// minTest and maxTest are indexed with 1 at the beginning, but the slice starts at 0
for i := minTest - 1; i < maxTest; i++ {
testSuites[i].RunTests()
for currSuite = minTest - 1; currSuite < maxTest; currSuite++ {
testSuites[currSuite].RunTests()
}
// tally errors
totalerrors := nodeA.Errors + nodeB.Errors + nodeC.Errors + littleClient.Errors
if totalerrors > 0 {
for s, errorCount := range failures {
if errorCount > 0 {
log.Error().Msgf("Suite %s: %d Errors", testSuites[s].Name(), errorCount)
continue
}
log.Info().Msgf("Suite %s: OK!", testSuites[s].Name())
}
log.Error().Msgf("Total Errors: %d", totalerrors)
}
log.Info().Msgf("%d Tests Completed in %.2f seconds", maxTest-minTest+1, float64(time.Now().UnixNano()-startTime.UnixNano())/1e9)
os.Exit(totalerrors)
}
......@@ -161,6 +178,8 @@ func logNodeFailure(node *grpcclient.Node, expected, result string) {
wait()
log.Warn().Str("node", node.ID).Msgf("expected: %s, but got: %#v", expected, result)
node.Errors++
failures[currSuite]++
}
func wait() {
......@@ -168,6 +187,6 @@ func wait() {
log.Info().Msg("Please press enter to continue:")
_, _, _ = reader.ReadLine()
} else {
time.Sleep(1 * time.Second)
time.Sleep(*waitTime)
}
}
......@@ -9,6 +9,10 @@ type ReplicaSuite struct {
c *Config
}
func (t *ReplicaSuite) Name() string {
return "Replication"
}
func (t *ReplicaSuite) RunTests() {
// Fun with replicas
logNodeAction(t.c.nodeA, "Create keygroup KGRep")
......
......@@ -8,6 +8,10 @@ type SelfReplicaSuite struct {
c *Config
}
func (t *SelfReplicaSuite) Name() string {
return "Self Replication"
}
func (t *SelfReplicaSuite) RunTests() {
// testing adding a node as a replica for a keygroup on itself
logNodeAction(t.c.nodeB, "Create and populate a new keygroup to test pulling")
......
......@@ -8,6 +8,10 @@ type StandardSuite struct {
c *Config
}
func (t *StandardSuite) Name() string {
return "Standard"
}
func (t *StandardSuite) RunTests() {
// Test Keygroups
logNodeAction(t.c.nodeA, "Creating keygroup testing")
......
......@@ -8,6 +8,7 @@ import (
type TestSuite interface {
// RunTests runs all tests of this testsuite
RunTests()
Name() string
}
type Config struct {
......
......@@ -12,6 +12,9 @@ type TriggerSuite struct {
c *Config
}
func (t *TriggerSuite) Name() string {
return "Trigger"
}
func (t *TriggerSuite) RunTests() {
// let's test trigger nodes
// create a new keygroup on nodeA
......
# Shamelessly stolen from the original dockerfile
# building the binary
FROM golang:1.15-alpine
FROM golang:1.16-alpine
LABEL maintainer="tp@mcc.tu-berlin.de"
......@@ -22,4 +22,4 @@ COPY . .
RUN go install ./tests/AlexandraTest/cmd/main/
ENTRYPOINT ["/go/bin/main"]
\ No newline at end of file
ENTRYPOINT ["/go/bin/main"]
......@@ -26,6 +26,8 @@ services:
--little-key-file='/cert/littleclient.key' \
--test-range=${TEST_RANGE} \
--wait-user=false"
environment:
SECRET_KEY: "${SECRET_KEY:-default_secret_key}"
volumes:
- ./certificates/client.crt:/cert/client.crt
- ./certificates/client.key:/cert/client.key
......
export TEST_RANGE := -
.PHONY: all clean 3nodetest 3nodetest-debug-nodeB 3n-all 3n-standard 3n-replica 3n-trigger 3n-immutable 3n-expiry 3n-selfreplica 3n-auth 3n-concurrency fred failtest alexandra
all: clean 3n-all clean
......@@ -6,7 +8,6 @@ clean: ## clean up all resources
@docker-compose -f etcd.yml -f nodeA.yml -f nodeB.yml -f nodeC.yml -f 3NodeTester.yml -f trigger.yml down --remove-orphan
@docker network remove fredwork || true
3n-all: export TEST_RANGE = -
3n-standard: export TEST_RANGE = 1-1
3n-replica: export TEST_RANGE = 2-2
3n-trigger: export TEST_RANGE = 3-3
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment