-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add first golang-only test #1037
base: master
Are you sure you want to change the base?
Changes from all commits
a818a46
a0d144e
014d001
41bac05
0479cde
96517df
1be9d4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,9 @@ func newSetupCmd(configName, verbosity *string) *cobra.Command { | |
Long: `Setup harness.`, | ||
PersistentPreRunE: preRunViperLoadFunction(cfg, configName, verbosity), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if err := openevec.ConfigCheck(*configName); err != nil { | ||
log.Fatalf("Config check failed %s", err) | ||
} | ||
// if err := openevec.ConfigCheck(*configName); err != nil { | ||
// log.Fatalf("Config check failed %s", err) | ||
// } | ||
Comment on lines
+26
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🫡 |
||
if err := openEVEC.SetupEden(*configName, configDir, softSerial, zedControlURL, ipxeOverride, grubOptions, netboot, installer); err != nil { | ||
|
||
log.Fatalf("Setup eden failed: %s", err) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package defaults | ||
|
||
//DefaultEdenTemplate is configuration template for Eden | ||
// DefaultEdenTemplate is configuration template for Eden | ||
const DefaultEdenTemplate = `#config is generated by eden | ||
adam: | ||
#tag on adam container to pull | ||
|
@@ -317,7 +317,7 @@ | |
network-model: '{{parse "sdn.network-model"}}' | ||
` | ||
|
||
//DefaultQemuTemplate is configuration template for qemu | ||
// DefaultQemuTemplate is configuration template for qemu | ||
const DefaultQemuTemplate = `#qemu config file generated by eden | ||
{{- if .Firmware }} | ||
{{ $firmwareLength := len .Firmware }}{{ if eq $firmwareLength 1 }} | ||
|
@@ -428,3 +428,152 @@ | |
</Shot> | ||
</Snapshots> | ||
</Parallels_disk_image>` | ||
|
||
// DefaultEdenTemplate is configuration template for Eden | ||
const DefaultActivateShTemplate = `# This file must be used with "source bin/activate" *from bash* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh yes, we should remove the files, they're not needed anymore, thx! |
||
# you cannot run it directly | ||
|
||
if [ "${BASH_SOURCE-}" = "$0" ]; then | ||
echo "You must source this script: \$ source $0" >&2 | ||
exit 33 | ||
fi | ||
|
||
eden_deactivate () { | ||
# reset old environment variables | ||
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all | ||
if ! [ -z "${_OLD_EDEN_PATH:+_}" ] ; then | ||
PATH="$_OLD_EDEN_PATH" | ||
export PATH | ||
unset _OLD_EDEN_PATH | ||
fi | ||
|
||
# This should detect bash and zsh, which have a hash command that must | ||
# be called to get it to forget past commands. Without forgetting | ||
# past commands the $PATH changes we made may not be respected | ||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then | ||
hash -r 2>/dev/null | ||
fi | ||
|
||
if ! [ -z "${_OLD_EDEN_PS1+_}" ] ; then | ||
PS1="$_OLD_EDEN_PS1" | ||
export PS1 | ||
unset _OLD_EDEN_PS1 | ||
fi | ||
|
||
unset EDEN_HOME | ||
if [ ! "${1-}" = "nondestructive" ] ; then | ||
# Self destruct! | ||
unset -f eden_deactivate | ||
unset -f eden_config | ||
unset -f eden-config | ||
unset -f eden+config | ||
fi | ||
} | ||
|
||
eden_config () { | ||
if [ $# -eq 0 ] | ||
then | ||
echo Usage: eden_config config | ||
return | ||
fi | ||
|
||
eden config set $1 | ||
PS1="EDEN-$(eden config get)_${_OLD_EDEN_PS1-}" | ||
} | ||
|
||
eden+config () { | ||
if [ $# -eq 0 ] | ||
then | ||
echo Usage: eden+config config | ||
return | ||
fi | ||
|
||
cd $(eden config get --key eden.root)/.. | ||
eden config add $1 | ||
cd - | ||
} | ||
|
||
eden-config () { | ||
if [ $# -eq 0 ] | ||
then | ||
echo Usage: eden-config config | ||
return | ||
fi | ||
|
||
eden config delete $1 | ||
eden_config default | ||
} | ||
|
||
# unset irrelevant variables | ||
eden_deactivate nondestructive | ||
|
||
EDEN_HOME={{.Eden.Root}} | ||
EDEN_BIN={{.Eden.BinDir}} | ||
export EDEN_HOME | ||
|
||
_OLD_EDEN_PATH="$PATH" | ||
PATH="$EDEN_BIN:$PATH" | ||
export PATH | ||
|
||
if [ -z "${EDEN_HOME_DISABLE_PROMPT-}" ] ; then | ||
_OLD_EDEN_PS1="${PS1-}" | ||
PS1="EDEN-$(eden config get)_${PS1-}" | ||
export PS1 | ||
fi | ||
|
||
# This should detect bash and zsh, which have a hash command that must | ||
# be called to get it to forget past commands. Without forgetting | ||
# past commands the $PATH changes we made may not be respected | ||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then | ||
hash -r 2>/dev/null | ||
fi | ||
` | ||
|
||
const DefaultActivateCshTemplate = `# This file must be used with "source bin/activate.csh" *from csh*. | ||
# You cannot run it directly. | ||
|
||
set newline='\ | ||
' | ||
|
||
alias eden_deactivate 'test $?_OLD_EDEN_PATH != 0 && setenv PATH "$_OLD_EDEN_PATH:q" && unset _OLD_EDEN_PATH; rehash; test $?_OLD_EDEN_PROMPT != 0 && set prompt="$_OLD_EDEN_PROMPT:q" && unset _OLD_EDEN_PROMPT; unsetenv EDEN_HOME; test "\!:*" != "nondestructive" && unalias eden_deactivate && unalias eden_config && unalias eden+config && unalias eden-config' | ||
|
||
alias eden_config 'eden config set \!:1 && set prompt="EDEN-$(eden config get)_$_OLD_EDEN_PROMPT:q"' | ||
|
||
alias eden+config 'cd $(eden config get --key eden.root)/..; eden config add \!:1; cd -' | ||
alias eden-config 'eden config delete \!:1; eden_config default' | ||
|
||
# Unset irrelevant variables. | ||
eden_deactivate nondestructive | ||
|
||
setenv EDEN_HOME "{{.Eden.Root}}" | ||
|
||
set _OLD_EDEN_PATH="$PATH:q" | ||
setenv PATH "{{.Eden.BinDir}}:$PATH:q" | ||
|
||
if ( $?EDEN_DISABLE_PROMPT ) then | ||
if ( $EDEN_DISABLE_PROMPT == "" ) then | ||
set do_prompt = "1" | ||
else | ||
set do_prompt = "0" | ||
endif | ||
else | ||
set do_prompt = "1" | ||
endif | ||
|
||
if ( $do_prompt == "1" ) then | ||
# Could be in a non-interactive environment, | ||
# in which case, $prompt is undefined and we wouldn't | ||
# care about the prompt anyway. | ||
if ( $?prompt ) then | ||
set _OLD_EDEN_PROMPT="$prompt:q" | ||
if ( "$prompt:q" =~ *"$newline:q"* ) then | ||
: | ||
else | ||
set prompt = "eden-$(eden config get)_$prompt:q" | ||
endif | ||
endif | ||
endif | ||
|
||
unset do_prompt | ||
|
||
rehash` |
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.
will all these functions be removed anyway once NeoEden tests are done?
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.
Not so sure about it,
talking about it on high-level: openevec is your Code As Infrastructure (think terraform) which allows you to describe your environment to deploy EVE, then you have your evetestkit which allows you to access certain states of EVE, Adam and then you have a test, which utilizes openevec and evetestkit to setup certain environment, run certain commands via controller and check EVE state. Openevec can also be used to setup a certain environment via CLI.
So broadly speaking, I can see scenarios, where I'd like to keep configurations persistent and therefore want to keep it on disk. Talking about it practically, we can't remove it, because changers are dependent on default folder structure and files, in theory we could remove it, propogating configuration there, but that'd be another big refactoring patch, as of now I'd pursue this
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.
I mean in more broader terms: can we remove the
eden
commands?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.
but your overview is very nice, thank you ❤️
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.
hmmm, that's an interesting take... Do we want Eden commands at all? I'd say yes. Imagine this: you run tests and then it gets stuck or fails, then in order to investigate you just set it up to a certain condition and then you can use eden commands to play around, ssh into thing, change certificates, etc. etc. so you don't waste time writing one openevec command and then rerunning the whole thing, rather do it interactively