-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GRAPH] Fix #158, add triggering files, add tests
Based on my research, the panic came from the call to graph.Walk within graph.Copy. With help from @BrianHicks, I was able to: 1. fix the bug with new, simpler logic for graph.Copy 2. those hcl files that triggered the race condition 3. add a blackbox test, which works with the hcl files 4. add a benchmark test case for testing parallel copies
- Loading branch information
Showing
6 changed files
with
126 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
ROOT=$(pwd) | ||
|
||
TMP=$(mktemp -d -t converge.graph_dependencies.XXXXXXXXXX) | ||
function finish { | ||
rm -rf $TMP | ||
} | ||
trap finish EXIT | ||
|
||
pushd $TMP | ||
|
||
for src in ${ROOT}/samples/dependencies/*.hcl; do | ||
b=$(basename $src) | ||
echo "starting repetative graph test for ${b}" | ||
for i in `seq 1 5`; do | ||
${ROOT}/converge graph -l "WARN" ${src} >/dev/null | ||
done | ||
echo "success: no errors generating dependencies for ${b}" | ||
done | ||
echo "success: no errors for any .hcl files" | ||
|
||
popd |
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
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,28 @@ | ||
# cert | ||
param "cn" {} | ||
param "name" {} | ||
param "ca_crt" { | ||
default = "ca.crt" | ||
} | ||
param "ca_key" { | ||
default = "ca.key" | ||
} | ||
task "directory" { | ||
check = "test -d ssl" | ||
apply = "mkdir ssl" | ||
} | ||
task "key" { | ||
check = "test -f ssl/{{param `name`}}.key" | ||
apply = "cd ssl; openssl genrsa -out {{param `name`}}.key 2048" | ||
depends = ["task.directory"] | ||
} | ||
task "csr" { | ||
check = "test -f ssl/{{param `name`}}.csr" | ||
apply = "cd ssl; openssl req -new -key {{param `name`}}.key --subj \"/CN={{param `cn`}}\" -out {{param `name`}}.csr" | ||
depends = ["task.key"] | ||
} | ||
task "crt" { | ||
check = "test -f ssl/{{param `name`}}.crt" | ||
apply = "cd ssl; openssl x509 -req -in {{param `name`}}.csr -CA {{param `ca_crt`}} -CAkey {{param `ca_key`}} -CAcreateserial -out {{param `name`}}.crt -days 10000" | ||
depends = ["task.csr"] | ||
} |
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,39 @@ | ||
# create certificates for a Kubernetes cluster | ||
param "master_ip" {} | ||
|
||
task "directory" { | ||
check = "test -d ssl" | ||
apply = "mkdir ssl" | ||
} | ||
|
||
task "ca.key" { | ||
check = "test -f ssl/ca.key" | ||
apply = "cd ssl; openssl genrsa -out ca.key 2048" | ||
|
||
depends = ["task.directory"] | ||
} | ||
|
||
task "ca.crt" { | ||
check = "test -f ssl/ca.crt" | ||
apply = "cd ssl; openssl req -x509 -new -nodes -key ca.key -subj \"/CN={{param `master_ip`}}\" -days 10000 -out ca.crt" | ||
|
||
depends = ["task.ca.key"] | ||
} | ||
|
||
module "cert.hcl" "server" { | ||
params { | ||
cn = "{{param `master_ip`}}" | ||
name = "server" | ||
} | ||
|
||
depends = ["task.ca.key", "task.ca.crt"] | ||
} | ||
|
||
module "cert.hcl" "kubelet" { | ||
params { | ||
cn = "{{param `master_ip`}}" | ||
name = "kubelet" | ||
} | ||
|
||
depends = ["task.ca.key", "task.ca.crt"] | ||
} |
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,21 @@ | ||
param "working-directory" { | ||
default = "/tmp/converge-testing" | ||
} | ||
|
||
param "test-file" { | ||
default = "{{param `working-directory`}}/test-file" | ||
} | ||
|
||
task "directory" { | ||
check = "[ -d \"{{param `working-directory`}}\" ] && echo present || (echo absent && exit 1)" | ||
apply = "mkdir -p {{param `working-directory`}}" | ||
} | ||
|
||
task "touch-file" { | ||
interpreter = "/bin/bash" | ||
check_flags = ["-n"] | ||
|
||
check = "cat {{param `test-file`}} | grep \"hello\"" | ||
apply = "echo hello > {{param `test-file`}}" | ||
depends = ["task.directory"] | ||
} |