2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-22 10:10:12 +00:00

Fix tests

Update query sorting for recordset search
Update `How to Search` instructions
This commit is contained in:
Emerle, Ryan 2022-05-16 14:33:12 -04:00
parent c49b74e1aa
commit 9ffef4aa80
No known key found for this signature in database
GPG Key ID: C0D34C592AED41CE
6 changed files with 68 additions and 62 deletions

View File

@ -441,16 +441,7 @@ class MySqlRecordSetCacheRepositoryIntegrationSpec
"return applicable recordsets in descending order when recordNameFilter is given and name sort is descending" in {
val existing = insert(okZone, 10).map(_.recordSet)
val found = recordSetCacheRepo
.listRecordSetData(None, None, None, Some("*.ok*"), None, None, NameSort.DESC)
.unsafeRunSync()
found.recordSets should contain theSameElementsAs existing
.map(r => recordSetDataWithFQDN(r, okZone))
.reverse
}
"return applicable recordsets in descending order when recordNameFilter supports full-text" in {
val existing = insert(okZone, 10).map(_.recordSet)
val found = recordSetCacheRepo
.listRecordSetData(None, None, None, Some("apply*test"), None, None, NameSort.DESC)
.listRecordSetData(None, None, None, Some("*.recordsets."), None, None, NameSort.DESC)
.unsafeRunSync()
found.recordSets should contain theSameElementsAs existing
.map(r => recordSetDataWithFQDN(r, okZone))

View File

@ -314,11 +314,11 @@ class MySqlRecordSetCacheRepository
)
case (false, NameSort.ASC) =>
pagingKey.as(
sqls"((recordset_data.fqdn >= ${pagingKey.map(pk => pk.recordName)} AND recordset.type > ${pagingKey.map(pk => pk.recordType)}) OR recordset_data.fqdn > ${pagingKey.map(pk => pk.recordName)})"
sqls"((recordset.fqdn >= ${pagingKey.map(pk => pk.recordName)} AND recordset.type > ${pagingKey.map(pk => pk.recordType)}) OR recordset.fqdn > ${pagingKey.map(pk => pk.recordName)})"
)
case (false, NameSort.DESC) =>
pagingKey.as(
sqls"((recordset_data.fqdn <= ${pagingKey.map(pk => pk.recordName)} AND recordset.type > ${pagingKey.map(pk => pk.recordType)}) OR recordset_data.fqdn < ${pagingKey.map(pk => pk.recordName)})"
sqls"((recordset.fqdn <= ${pagingKey.map(pk => pk.recordName)} AND recordset.type > ${pagingKey.map(pk => pk.recordType)}) OR recordset.fqdn < ${pagingKey.map(pk => pk.recordName)})"
)
case _ =>
pagingKey.as(
@ -338,10 +338,10 @@ class MySqlRecordSetCacheRepository
(zoneAndNameFilters ++ sortBy ++ typeFilter ++ ownerGroupFilter).toList
val qualifiers = if (nameSort == ASC) {
sqls"ORDER BY recordset_data.fqdn ASC, recordset.type ASC "
sqls"ORDER BY recordset.fqdn ASC, recordset.type ASC "
}
else {
sqls"ORDER BY recordset_data.fqdn DESC, recordset.type ASC "
sqls"ORDER BY recordset.fqdn DESC, recordset.type ASC "
}
val recordLimit = maxPlusOne match {
@ -358,7 +358,6 @@ class MySqlRecordSetCacheRepository
// Join query for data column from recordset table
val recordsetDataJoin = sqls"RIGHT JOIN recordset ON recordset.id=recordset_data.recordset_id "
val recordsetDataJoinQuery = initialQuery.append(recordsetDataJoin)
val appendOpts = if (opts.nonEmpty) {

View File

@ -39,24 +39,31 @@
<div class="collapse" id="collapseInstruction">
<div class="well">
<p>The search is based on the fully qualified domain name (FQDN) of a record. You can do an exact match search or fuzzy match to lookup records.</p>
<p>A minimum of two alphanumeric characters for the record name is <i>required</i> for searching.</p>
<p><strong>Examples:</strong>
<p>
A minimum of <strong>two alphanumeric characters</strong> for the record name is <em>required</em> for searching. Also,
a search term cannot <strong>both start and end</strong> with a wildcard character.
</p>
<p>
<strong>Examples:</strong>
<ul>
<li>test.example.com. -> test.example.com.</li>
<li>test.example.com -> test.example.com.</li>
<li>test.* -> test.example.com., test.example.net., test.net.</li>
<li>*example.com -> one.example.com., test.example.com.</li>
<li>*example* -> one.example.com., test.example.com., test.example.net.</li>
<li>test.example.com. -&gt; test.example.com.</li>
<li>test.example.com -&gt; test.example.com.</li>
<li>test.* -&gt; test.example.com., test.example.net., test.net.</li>
<li>*example.com -&gt; one.example.com., test.example.com.</li>
<li>*example* -&gt; <strong>INVALID</strong></li>
</ul>
</p>
<hr/>
<h5>PTR Records</h5>
<p>For PTR records you can look up records by their IP address or by their FQDN. Compressed or expanded formats of IPv6 addresses are supported. Partial matching is not supported.</p>
<p><strong>Examples:</strong>
<p>For PTR records you can look up records by their IP address or by their FQDN. Compressed or expanded formats of IPv6 addresses are supported. </p>
<p>Partial matching of IP addresses is not supported, but partial matching of the FQDN is supported.</p>
<p>
<strong>Examples:</strong>
<ul>
<li>4.4.8.8.in-addr.arpa. -> 4.4.8.8.in-addr.arpa.</li>
<li>8.8.4.4 -> 4.4.8.8.in-addr.arpa.</li>
<li>2001:db8::567:89ab -> b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.</li>
<li>4.4.8.8.in-addr.arpa. -&gt; 4.4.8.8.in-addr.arpa.</li>
<li>*.4.8.8.in-addr.arpa. -&gt; 2.4.8.8.in-addr.arpa., 3.4.8.8.in-addr.arpa., 4.4.8.8.in-addr.arpa.</li>
<li>8.8.4.4 -&gt; 4.4.8.8.in-addr.arpa.</li>
<li>2001:db8::567:89ab -&gt; b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.</li>
</ul>
</p>
</div>
@ -167,8 +174,8 @@
{{record.fqdn}}
</div>
</td>
<td class="wrap-long-text">{{record.type}}</td>
<td class="wrap-long-text">{{record.ttl}}</td>
<td class="no-wrap">{{record.type}}</td>
<td class="no-wrap">{{record.ttl}}</td>
<td class="record-data wrap-long-text">
<span ng-if="record.accessLevel != 'NoAccess'">
<span ng-if="record.type == 'A'">

View File

@ -425,6 +425,11 @@ input[type="file"] {
word-break: break-all;
}
.no-wrap {
white-space: nowrap;
word-break: keep-all;
}
.record-data-label {
vertical-align: top;
}

View File

@ -26,13 +26,13 @@ From a shell in the `quickstart/` directory, simply run:
The `quickstart-vinyldns.sh` script takes a number of optional arguments:
| Flag | Description |
|:------------------|:----------------------------------------------------------------------------------------------------|
|:------------------|:-----------------------------------------------------------------------------------------------------------------------|
| -a, --api | start the API, but not the Portal and its dependencies (e.g., LDAP) |
| -b, --build | force a rebuild of the Docker images with the local code |
| -c, --clean | stops all VinylDNS containers and exits |
| -d, --deps | start up the dependencies, but not the API or Portal |
| -sh, --shell | loads the .env file into a new BASH shell. The .env file can be overridden with -e |
| -e, --env-file | specifies the path (relative to the docker-compose file) to the .env file to load (e.g., .env.dev). |
| -e, --env-file | specifies the suffix of the .env file (relative to the docker-compose file) to load (e.g., 'dev' - to load '.env.dev') |
| -r, --reset | stops any the running containers before starting new containers |
| -s, --service | specify the service to run |
| -t, --timeout | the time to wait (in seconds) for the Portal and API to start (default: 60) |
@ -53,7 +53,7 @@ Let's say you have a `.env.dev` file in the `quickstart/` directory. You can loa
shell with
```shell
$ ./quickstart/quickstart.sh --env-file .env.dev --sh
$ ./quickstart/quickstart.sh -sh --env-file dev # To load .env.dev just specify the suffix - dev
Please wait.. creating a new shell with the environment variables set.
To return, simply exit the new shell with 'exit' or ^D.
$

View File

@ -24,7 +24,7 @@ function usage() {
echo -e "\t-c, --clean stops all VinylDNS containers and exits"
echo -e "\t-d, --deps start up the dependencies, but not the API or Portal"
echo -e "\t-sh, --shell loads the .env file into a new BASH shell. The .env file can be overridden with -e"
echo -e "\t-e, --env-file specifies the path (relative to the docker-compose file) to the .env file to load (e.g., .env.dev)."
echo -e "\t-e, --env-file specifies the suffix of the .env file (relative to the docker-compose file) to load (e.g., 'dev' - to load '.env.dev')"
echo -e "\t-r, --reset stops any the running containers before starting new containers"
echo -e "\t-s, --service specify the service to run"
echo -e "\t-t, --timeout the time to wait (in seconds) for the Portal and API to start (default: 60)"
@ -84,6 +84,7 @@ RESET_DOCKER=0
UPDATE=0
CLEAN=0
ENV_FILE="${DIR}/.env"
SHELL_REQUESTED=0
while [[ $# -gt 0 ]]; do
case "$1" in
-t | --timeout)
@ -125,15 +126,15 @@ while [[ $# -gt 0 ]]; do
shift
;;
-sh | --shell)
# shellcheck disable=SC2046
export $(grep -Ev '^#' "${ENV_FILE}" | xargs)
echo "Please wait.. creating a new shell with the environment variables set."
echo "To return, simply exit the new shell with 'exit' or ^D."
bash
exit
SHELL_REQUESTED=1
shift
;;
-e | --env-file)
export ENV_FILE="${DIR}/$2"
if [ ! -f "${DIR}/.env.$2" ]; then
echo "Cannot load ${DIR}/.env.$2"
exit 1
fi
export ENV_FILE="${DIR}/.env.$2"
shift
shift
;;
@ -151,12 +152,15 @@ while [[ $# -gt 0 ]]; do
esac
done
# Source customizable env files ('-a' causes all variables to be exported)
# Load environment variables
export $(echo $(cat "${ENV_FILE}" | sed 's/#.*//g'| xargs) | envsubst)
set -a
# shellcheck disable=SC1090
source "${ENV_FILE}"
set +a
if [[ $SHELL_REQUESTED -eq 1 ]]; then
echo "Please wait.. creating a new shell with the environment variables set."
echo "To return, simply exit the new shell with 'exit' or ^D."
bash
exit
fi
# The version of VinylDNS docker image to run
export VINYLDNS_VERSION=latest