Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
neriumrevolta committed Feb 14, 2024
1 parent a57a5c1 commit 9b2fde1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 39 deletions.
53 changes: 26 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# copy of https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
branches: [main]
pull_request_review:
types: [submitted]

name: CI

Expand All @@ -22,38 +21,30 @@ jobs:
check:
name: Check
env:
SQLX_OFFLINE: true
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
strategy:
matrix:
include:
- os: ubuntu-latest
toolchain: stable-x86_64-unknown-linux-gnu
- os: macos-latest
toolchain: stable-x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Check .sqlx directory presence
run: |
if [ ! -d ".sqlx" ]; then
echo ".sqlx directory is missing. Failing the workflow."
exit 1
else
echo ".sqlx directory is present. Continuing..."
ls -la .sqlx
fi
- name: Checkout submodules
run: git submodule update --init --recursive
- uses: actions/setup-go@v4
- uses: actions/setup-go@v4 # we need go to build go-waku
with:
go-version: '1.19'
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable-x86_64-unknown-linux-gnu
toolchain: ${{ matrix.toolchain }}
default: true
override: true
- name: List project directory contents after checkout
run: |
ls -la
echo "Contents of .sqlx directory (if present):"
ls -la .sqlx || echo ".sqlx directory not found."
- uses: actions-rs/cargo@v1
continue-on-error: false
with:
Expand All @@ -65,20 +56,28 @@ jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
strategy:
matrix:
include:
- os: ubuntu-latest
toolchain: stable-x86_64-unknown-linux-gnu
- os: macos-latest
toolchain: stable-x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Checkout submodules
run: git submodule update --init --recursive
- uses: actions/setup-go@v4
- uses: actions/setup-go@v4 # we need go to build go-waku
with:
go-version: '1.19'
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable-x86_64-unknown-linux-gnu
toolchain: ${{ matrix.toolchain }}
default: true
override: true
- uses: actions-rs/cargo@v1
Expand Down
19 changes: 7 additions & 12 deletions src/db/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,31 +257,26 @@ pub async fn list_active_indexers(
#[cfg(test)]
mod tests {
use crate::message_types::PublicPoiMessage;

use super::*;


use sqlx::PgPool;




async fn insert_test_data(pool: &PgPool, entries: Vec<(i64, &str)>) {
for (nonce, graph_account) in entries {
let message = PublicPoiMessage {
identifier: "Qm123".to_string(),
content: "text".to_string(),
identifier: "QmTamam".to_string(),
content: "0xText".to_string(),
nonce: nonce.try_into().unwrap(),
network: "text".to_string(),
network: "testnet".to_string(),
block_number: 1,
block_hash: "hash".to_string(),
graph_account: graph_account.to_string(),
};

add_message(pool, message).await.expect("Failed to insert test data");

add_message(pool, message)
.await
.expect("Failed to insert test data");
}
}


#[sqlx::test(migrations = "./migrations")]
async fn test_list_active_indexers_without_indexers(pool: PgPool) {
Expand Down

0 comments on commit 9b2fde1

Please sign in to comment.