-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: megaparse sdk tests #148
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b59b56a
working parsing
d6f0e3d
tests timeouts
84d6905
tests errors
60cf32a
test CI
f965ce1
any worker
7e01702
runs on
4513b57
ci
499408c
ci
8b4ac88
ci
81021ec
ci
4fa1903
ci
bac14f3
ci
4c0e19b
ci
46b789b
ci
0b3e7ff
ci
45a9047
ci
e42e0d1
ci
111c223
ci
7b064c0
ci
5148000
ci
39d6a27
ci
ff40d8c
CI timeout tests
b4f6ebc
added sudo
2395be2
ci
d4a2e10
remove tls CI
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,87 @@ | ||
name: Run Tests API and Worker | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
NATS_TOKEN: test | ||
|
||
jobs: | ||
test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 👀 Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Setup apt cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /var/cache/apt/archives | ||
key: ${{ runner.os }}-apt-${{ hashFiles('/etc/apt/sources.list') }} | ||
|
||
- name: 😭 Install system dependencies | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y \ | ||
netcat \ | ||
unzip \ | ||
libgeos-dev \ | ||
libcurl4-openssl-dev \ | ||
libssl-dev \ | ||
binutils \ | ||
curl \ | ||
git \ | ||
autoconf \ | ||
automake \ | ||
build-essential \ | ||
libtool \ | ||
gcc \ | ||
libmagic-dev \ | ||
poppler-utils \ | ||
tesseract-ocr \ | ||
libreoffice \ | ||
libpq-dev \ | ||
pandoc | ||
|
||
- name: 🔽 Download and Install NATS Server | ||
run: | | ||
curl -L https://github.com/nats-io/nats-server/releases/download/v2.10.22/nats-server-v2.10.22-linux-amd64.zip -o nats-server.zip | ||
unzip nats-server.zip -d nats-server && sudo cp nats-server/nats-server-v2.10.22-linux-amd64/nats-server /usr/bin | ||
|
||
- name: 🛠️ Set up NATS arguments | ||
run: | | ||
nohup nats-server \ | ||
--addr 0.0.0.0 \ | ||
--port 4222 \ | ||
--auth "$NATS_TOKEN" > nats.log 2>&1 & | ||
|
||
- name: 🔍 Verify NATS Server is Running | ||
run: | | ||
sleep 1 # Give the server some time to start | ||
if nc -zv localhost 4222; then | ||
echo "✅ NATS Server is running on port 4222." | ||
else | ||
echo "❌ Failed to start NATS Server." | ||
cat nats.log | ||
exit 1 | ||
fi | ||
|
||
- name: 🔨 Install the latest version of rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
enable-cache: true | ||
|
||
- name: 🎯 Cache hit! | ||
if: steps.setup-rye.outputs.cache-hit == 'true' | ||
run: echo "Rye cache was restored" | ||
|
||
- name: 🔄 Sync dependencies | ||
run: | | ||
UV_INDEX_STRATEGY=unsafe-first-match rye sync --no-lock | ||
|
||
- name: 🚀 Run tests | ||
run: | | ||
rye test -p megaparse-sdk |
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 |
---|---|---|
|
@@ -17,9 +17,9 @@ class MegaParseConfig(BaseSettings): | |
|
||
|
||
class SSLConfig(BaseModel): | ||
ca_cert_file: FilePath | ||
ssl_key_file: FilePath | ||
ssl_cert_file: FilePath | ||
ca_cert_file: FilePath | None = None | ||
|
||
|
||
class ClientNATSConfig(BaseSettings): | ||
|
@@ -28,7 +28,10 @@ class ClientNATSConfig(BaseSettings): | |
) | ||
subject: Literal["parsing"] = "parsing" | ||
endpoint: str = "https://[email protected]:4222" | ||
timeout: int = 600 | ||
timeout: float = 600 | ||
max_retries: int = 5 | ||
backoff: int = 3 | ||
backoff: float = 3 | ||
connect_timeout: int = 5 | ||
reconnect_time_wait: int = 1 | ||
max_reconnect_attempts: int = 20 | ||
ssl_config: SSLConfig | None = None |
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
Empty file.
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,29 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIFCzCCA3OgAwIBAgIQESt0eck2KvFrAMyiDyceujANBgkqhkiG9w0BAQsFADCB | ||
nTEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMTkwNwYDVQQLDDBhbWlu | ||
ZUBhbWluZXMtTWFjQm9vay1Qcm8ubG9jYWwgKGFtaW5lIGRpcmhvdXNzaSkxQDA+ | ||
BgNVBAMMN21rY2VydCBhbWluZUBhbWluZXMtTWFjQm9vay1Qcm8ubG9jYWwgKGFt | ||
aW5lIGRpcmhvdXNzaSkwHhcNMjQxMTE5MTAwMTA5WhcNMzQxMTE5MTAwMTA5WjCB | ||
nTEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMTkwNwYDVQQLDDBhbWlu | ||
ZUBhbWluZXMtTWFjQm9vay1Qcm8ubG9jYWwgKGFtaW5lIGRpcmhvdXNzaSkxQDA+ | ||
BgNVBAM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DPXGd8BW0O0hpM5la81 | ||
J+rfZGinbcUgXM6JMLIHDxLc4Xxzm4NijFzXhbR3XPXqEwsnZOuxcYYFgUGs3FwS | ||
4ro+34a/O4uKS2KV8wsUWj/tWD2rLpduDgag4WSipCvWtaNve8gPdUiyPxUqxyoZ | ||
aFAFg/izXwmRntogJtV0Zvo3fqAaQQDl8t2s21IIx0wmgHzgmkswb5OwFg3dOn/S | ||
lmaH8v7FCBP7jHx/NCPTT5Sy/1EMRATmhFDUZ8Bod/TIlV3e+FCVqlX3kBBRbAU= | ||
-----END CERTIFICATE----- |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do you need all that ?