Skip to content
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

Issue 476 with some globalization updates and travis changes #477

Merged
merged 7 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ before_install:
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce || true

before_script:
- ($TRAVIS_PULL_REQUEST = ''false'') && (docker login -u="$DOCKER_HUB_USER" -p="$DOCKER_HUB_PASS") || (echo ''This is a PR, skipping the login'')
- make .docker-network
- docker run -d -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=$POSTGRES_DB -e POSTGRES_USER=$POSTGRES_USER --network
$DOCKER_NETWORK --name postgres postgres
Expand All @@ -43,7 +44,4 @@ script:
# Note: this does NOT run the IBM/OCP cloud tests or the multi-tenancy tests (because this travis script would have to stand up an OCP instance). Those tests must be run in your own dev environment.
- make test

after_success:
- '{ test $TRAVIS_PULL_REQUEST = ''false'' && [[ ! "$TRAVIS_COMMIT_MESSAGE" =~ "--skip-push" ]] &&
echo "$DOCKER_HUB_PASS" | docker login -u="$DOCKER_HUB_USER" --password-stdin && make docker-push-only; } ||
echo ''Skipping the push'''

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ Now you can disable root by setting `api.root.enabled` to `false` in `/etc/horiz
- detect if a pattern is updated with service that has userInput w/o default values, and give warning
- Consider changing all creates to POST, and update (via put/patch) return codes to 200

## Changes in 2.65.0

- Updating `lastUpdated` field of node on `POST /services_configstate` route
- New translation files, and file name fixes
- travis.yml updates

## Changes in 2.64.0

- Patch added to fix for issue 448. Missed one log message.
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/messages_es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ no.access.to.org=El emisor de la llamada no tiene acceso a la organización: {0}
invalid.account.id=ID de cuenta no válido
account.id.not.assigned.to.caller=No se ha asignado ID de cuenta al emisor de la llamada
account.id.invalid.or.not.assigned=El ID de cuenta no es válido o no se ha asignado al emisor de la llamada
user.cannot.be.in.root.org=En la organización raíz solo pueden existir el usuario raíz y los administradores de hub
user.cannot.be.in.root.org=En la organización raíz solo pueden existir el usuario root y los administradores de hub
creating.updating.superuser.not.allowed=No se permite la creación o actualización del usuario root
cannot.delete.root.user=No se puede suprimir el usuario root de Exchange
cannot.delete.root.org=No se puede suprimir la organización raíz de Exchange
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/messages_it.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ dockauth.must.be.int=dockauthid deve essere un numero intero: {1}
only.super.users.make.hub.admins=Questo utente non dispone delle autorizzazioni per creare Admin hub
org.limits.cannot.be.over.exchange.limits=I limiti specifici dell''organizzazione non possono essere superiori al limite Exchange globale. Limite organizzazione: {0}; limite Exchange: {1}
exchange.server.operating.normally=Server Exchange in funzione normalmente
hub.admins.in.root.org=Gli utenti Admin Hub Admin devono essere creati nell''organizzazione root
hub.admins.in.root.org=Gli utenti Admin Hub devono essere creati nell''organizzazione root
hub.admins.only.view.admins=Gli utenti Admin Hub possono visualizzare solo gli utenti admin dell''organizzazione
hub.admins.only.write.admins=Gli utenti Admin Hub possono solo creare o aggiornare gli utenti admin hub o admin dell''organizzazione
no.access.to.org=Il chiamante non dispone di accesso all''organizzazione: {0}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.64.0
2.65.0
3 changes: 2 additions & 1 deletion src/main/scala/com/horizon/exchangeapi/NodesRoutes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ final case class PostNodeConfigStateRequest(org: String, url: String, configStat

// Convert from struct back to string and return db action to update that
val newRegSvcsString: String = write(newRegSvcs)
(for { d <- NodesTQ.rows if d.id === id } yield (d.id,d.regServices,d.lastHeartbeat)).update((id, newRegSvcsString, Some(ApiTime.nowUTC)))
val nowTime = ApiTime.nowUTC
(for { d <- NodesTQ.rows if d.id === id } yield (d.id,d.regServices,d.lastHeartbeat,d.lastUpdated)).update((id, newRegSvcsString, Some(nowTime), nowTime))
}
}

Expand Down
19 changes: 18 additions & 1 deletion src/test/scala/com/horizon/exchangeapi/NodesSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,28 @@ class NodesSuite extends AnyFunSuite {
assert(dev.registeredServices.exists(m => m.url == NETSPEEDSPEC && m.configState.contains("active")))
}

test("POST /orgs/"+orgid+"/nodes/"+nodeId+"/services_configstate - change config state of sdr reg svc") {
test("POST /orgs/"+orgid+"/nodes/"+nodeId+"/services_configstate - change config state of sdr reg svc and test lastUpdated field changed") {
val response1: HttpResponse[String] = Http(URL+"/nodes/"+nodeId).headers(ACCEPT).headers(USERAUTH).asString
info("code: "+response1.code)
assert(response1.code === HttpCode.OK.intValue)
val getDevResp = parse(response1.body).extract[GetNodesResponse]
assert(getDevResp.nodes.contains(orgnodeId))
val dev = getDevResp.nodes(orgnodeId)
val initialLastUpdated = dev.lastUpdated

val input = PostNodeConfigStateRequest(orgid, SDRSPEC_URL, "suspended")
val response = Http(URL+"/nodes/"+nodeId+"/services_configstate").postData(write(input)).method("post").headers(CONTENT).headers(ACCEPT).headers(USERAUTH).asString
info("code: "+response.code)
assert(response.code === HttpCode.PUT_OK.intValue)

val response2: HttpResponse[String] = Http(URL+"/nodes/"+nodeId).headers(ACCEPT).headers(USERAUTH).asString
info("code: "+response2.code)
assert(response2.code === HttpCode.OK.intValue)
val getDevResp2 = parse(response2.body).extract[GetNodesResponse]
assert(getDevResp2.nodes.contains(orgnodeId))
val dev2 = getDevResp2.nodes(orgnodeId)
val newLastUpdated = dev2.lastUpdated
assert(newLastUpdated > initialLastUpdated)
}

test("POST /orgs/"+orgid+"/changes - verify " + nodeId + " services_configstate was created and stored") {
Expand Down