Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal committed Sep 9, 2024
1 parent 0f12ccc commit e8e8831
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/test-generate-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Setup function to create necessary files before each test
setup() {
mkdir -p out
mkdir -p conf
echo 'export AI_MEMORY_ELASTIC_SEARCH_URL="https://hw2nl.ddns.net/elasticsearch"' >conf/gpt-values-override-conf.default.sh
echo 'export AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX="index-ai-memory-default"' >>conf/gpt-values-override-conf.default.sh
echo 'export AI_MEMORY_PERSONAL_NAME="Test"' >>conf/gpt-values-override-conf.default.sh
Expand All @@ -18,7 +19,8 @@ setup() {
# Teardown function to clean up after each test
teardown() {
rm -rf out/
rm gpt-values-override-conf.default.sh
rm -rf conf/

rm gpt-values-override-conf.dist.sh

rm gpt-schema.dist.yml
Expand All @@ -35,13 +37,13 @@ teardown() {
@test "Check if warnings are displayed for missing variables in dist file" {
run bash ../generate-files.sh
[ "$status" -eq 0 ]
[[ "$output" == *"Warning: The variable AI_MEMORY_PERSONAL_NAME is defined in gpt-values-override-conf.default.sh but not in gpt-values-override-conf.dist.sh."* ]]
[[ "$output" == *"Warning: The variable AI_MEMORY_EXTRA_PERSONAL_INFO is defined in gpt-values-override-conf.default.sh but not in gpt-values-override-conf.dist.sh."* ]]
[[ "$output" == *"Warning: The variable AI_MEMORY_PERSONAL_NAME is defined in conf/gpt-values-override-conf.default.sh but not in gpt-values-override-conf.dist.sh."* ]]
[[ "$output" == *"Warning: The variable AI_MEMORY_EXTRA_PERSONAL_INFO is defined in conf/gpt-values-override-conf.default.sh but not in gpt-values-override-conf.dist.sh."* ]]
}

@test "Check if fallback values are used when variables are not defined in override file" {
echo 'export AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX=""' >gpt-values-override-conf.default.sh
echo 'export AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX=""' >conf/gpt-values-override-conf.default.sh
run bash ../generate-files.sh
[ "$status" -eq 0 ]
[[ "$output" == *"Warning: The variable AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX is not defined in gpt-values-override-conf.default.sh. The fallback value will be used."* ]]
[[ "$output" == *"Warning: The variable AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX is not defined in conf/gpt-values-override-conf.default.sh. The fallback value will be used."* ]]
}

0 comments on commit e8e8831

Please sign in to comment.