Skip to content

Commit

Permalink
fix-attempt: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal committed Sep 9, 2024
1 parent dc337e0 commit 0eb0083
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To install Elasticsearch, follow the official [Elasticsearch documentation](http

### 2. Create the Index

You need to create an index with the prefix `index-ai-memory-` and a suffix that you can set in the configuration file under the `AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX` variable. This can be done via the Elasticsearch CLI or Kibana.
You need to create an index with the prefix `index-ai-memory-` and a suffix that you can set in the configuration file under the `AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX` variable. This can be done via the Elasticsearch CLI or Kibana.

Example using Elasticsearch CLI:
```sh
Expand Down
4 changes: 2 additions & 2 deletions gpt-values-override-conf.dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export AI_MEMORY_ELASTIC_SEARCH_URL="https://your-elastic-search-url"

# Elasticsearch write index name
# This is the suffix of the index where the documents will be stored
# The final index name will be: index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}
# The final index name will be: index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX}
# Example: default
export AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX_SUFFIX="default"

# Elasticsearch read index name
# This is the suffix of the index where the documents will be read from
# The final index name will be: index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_INDEX_SUFFIX}
# The final index name will be: index-ai-memory-${AI_MEMORY_ELASTIC_SEARCH_READ_INDEX_SUFFIX}
# Example: default
export AI_MEMORY_ELASTIC_SEARCH_READ_INDEX_SUFFIX=*

Expand Down
14 changes: 7 additions & 7 deletions tests/test-generate-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Setup function to create necessary files before each test
setup() {
mkdir -p out
echo 'export AI_MEMORY_ELASTIC_SEARCH_URL="https://hw2nl.ddns.net/elasticsearch"' >gpt-values-override-conf.default.sh
echo 'export AI_MEMORY_ELASTIC_SEARCH_INDEX="index-ai-memory-default"' >>gpt-values-override-conf.default.sh
echo 'export AI_MEMORY_PERSONAL_NAME="Test"' >>gpt-values-override-conf.default.sh
echo 'export AI_MEMORY_EXTRA_PERSONAL_INFO="Interaction languages: English"' >>gpt-values-override-conf.default.sh
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
echo 'export AI_MEMORY_EXTRA_PERSONAL_INFO="Interaction languages: English"' >>conf/gpt-values-override-conf.default.sh

echo 'export AI_MEMORY_ELASTIC_SEARCH_URL="https://default-url.com"' >gpt-values-override-conf.dist.sh
echo 'export AI_MEMORY_ELASTIC_SEARCH_INDEX="default-index"' >>gpt-values-override-conf.dist.sh
echo 'export AI_MEMORY_ELASTIC_SEARCH_WRITE_INDEX="default-index"' >>gpt-values-override-conf.dist.sh

cp ../gpt-schema.dist.yml ./gpt-schema.dist.yml
cp ../gpt-instructions.dist.md ./gpt-instructions.dist.md
Expand Down Expand Up @@ -40,8 +40,8 @@ teardown() {
}

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

0 comments on commit 0eb0083

Please sign in to comment.