Skip to content

Commit

Permalink
Fix failing doc test
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Nov 14, 2024
1 parent aa9cb85 commit cff2418
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion docs/user/dql/metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Example 1: Show All Indices Information
SQL query::

os> SHOW TABLES LIKE '%'
fetched rows / total rows = 9/9
fetched rows / total rows = 10/10
+----------------+-------------+-----------------+------------+---------+----------+------------+-----------+---------------------------+----------------+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION |
|----------------+-------------+-----------------+------------+---------+----------+------------+-----------+---------------------------+----------------|
Expand All @@ -47,6 +47,7 @@ SQL query::
| docTestCluster | null | nested | BASE TABLE | null | null | null | null | null | null |
| docTestCluster | null | nyc_taxi | BASE TABLE | null | null | null | null | null | null |
| docTestCluster | null | people | BASE TABLE | null | null | null | null | null | null |
| docTestCluster | null | weblogs | BASE TABLE | null | null | null | null | null | null |
| docTestCluster | null | wildcard | BASE TABLE | null | null | null | null | null | null |
+----------------+-------------+-----------------+------------+---------+----------+------------+-----------+---------------------------+----------------+

Expand Down
7 changes: 3 additions & 4 deletions docs/user/ppl/functions/ip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ Return type: BOOLEAN

Example::

os> source=weblogs | where cidrmatch(host, "199.120.110.0/24") | fields host
fetched rows / total rows = 1/3
os> source=weblogs | where cidrmatch(host, "199.120.110.0/24") | fields host ;
fetched rows / total rows = 1/1
+----------------+
| host |
|----------------+
|----------------|
| 199.120.110.21 |
+----------------+

16 changes: 8 additions & 8 deletions doctest/test_docs.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0

import click
import doctest
import json
import os
import os.path
import zc.customdoctests
import json
import re
import random
import re
import subprocess
import unittest
import click

import zc.customdoctests
from functools import partial
from opensearch_sql_cli.formatter import Formatter
from opensearch_sql_cli.opensearch_connection import OpenSearchConnection
from opensearch_sql_cli.utils import OutputSettings
from opensearch_sql_cli.formatter import Formatter
from opensearchpy import OpenSearch, helpers

ENDPOINT = "http://localhost:9200"
Expand All @@ -29,7 +28,7 @@
WILDCARD = "wildcard"
NESTED = "nested"
DATASOURCES = ".ql-datasources"

WEBLOGS = "weblogs"

class DocTestConnection(OpenSearchConnection):

Expand Down Expand Up @@ -122,6 +121,7 @@ def set_up_test_indices(test):
load_file("wildcard.json", index_name=WILDCARD)
load_file("nested_objects.json", index_name=NESTED)
load_file("datasources.json", index_name=DATASOURCES)
load_file("weblogs.json", index_name=WEBLOGS)


def load_file(filename, index_name):
Expand Down Expand Up @@ -150,7 +150,7 @@ def set_up(test):

def tear_down(test):
# drop leftover tables after each test
test_data_client.indices.delete(index=[ACCOUNTS, EMPLOYEES, PEOPLE, ACCOUNT2, NYC_TAXI, BOOKS, APACHE, WILDCARD, NESTED], ignore_unavailable=True)
test_data_client.indices.delete(index=[ACCOUNTS, EMPLOYEES, PEOPLE, ACCOUNT2, NYC_TAXI, BOOKS, APACHE, WILDCARD, NESTED, WEBLOGS], ignore_unavailable=True)


docsuite = partial(doctest.DocFileSuite,
Expand Down

0 comments on commit cff2418

Please sign in to comment.