Skip to content

Commit

Permalink
Merge branch 'main' into 09260-add-schema-registry-component
Browse files Browse the repository at this point in the history
Signed-off-by: Kristiyan Selveliev <[email protected]>
  • Loading branch information
kselveliev committed Nov 15, 2024
2 parents 18e6dd0 + 8a78609 commit 9715335
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/checklist/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Deployed automatically on every tag.

A GA tag will trigger an automatic deployment to NA. Upon success, a PR for EU will automatically get created.

- [ ] Disk Snapshot for Citus is Taken (can be EU or NA)
- [ ] Deployed NA
- [ ] Deployed EU

Expand All @@ -66,6 +67,7 @@ These preprod environments are automatically deployed for any GA release. Ensure
Wait about a week after the testnet deployment to give it time to bake, then deploy to NA first. Upon success, a PR for
EU will automatically get created.

- [ ] Disk Snapshot for Citus is Taken (can be EU or NA)
- [ ] Deployed NA
- [ ] Deployed EU

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ describe('Response cache middleware', () => {
getHeaders: jest.fn(),
headers: {
'cache-control': `public, max-age=${cacheControlMaxAge}`,
'content-encoding': 'gzip'
},
locals: [],
removeHeader: jest.fn(),
send: jest.fn(),
set: jest.fn(),
status: jest.fn(),
setHeader: jest.fn(),
};
});

Expand Down Expand Up @@ -246,7 +246,8 @@ describe('Response cache middleware', () => {

await responseCacheCheckHandler(mockRequest, mockResponse, null);
expect(mockResponse.send).toBeCalledWith(cachedBody);
expect(mockResponse.set).toHaveBeenNthCalledWith(1, Object.assign(cachedHeaders, {'content-encoding': 'gzip'}));
expect(mockResponse.set).toHaveBeenNthCalledWith(1, cachedHeaders);
expect(mockResponse.setHeader).toHaveBeenNthCalledWith(1, 'content-encoding', 'gzip');
expect(mockResponse.status).toBeCalledWith(httpStatusCodes.OK.code);
});

Expand All @@ -264,6 +265,7 @@ describe('Response cache middleware', () => {
await responseCacheCheckHandler(mockRequest, mockResponse, null);
expect(mockResponse.send).toBeCalledWith(cachedBody);
expect(mockResponse.set).toHaveBeenNthCalledWith(1, cachedHeaders);
expect(mockResponse.setHeader).not.toBeCalled();
expect(mockResponse.status).toBeCalledWith(httpStatusCodes.OK.code);
});
});
Expand Down
5 changes: 2 additions & 3 deletions hedera-mirror-rest/middleware/responseCacheHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ const responseCacheCheckHandler = async (req, res, next) => {
res.status(statusCode);

if (isHead || clientCached) {
res.set(cachedResponse.headers);
res.status(statusCode);
res.end();
} else {
if (cachedResponse.compressed) {
Expand All @@ -60,9 +58,10 @@ const responseCacheCheckHandler = async (req, res, next) => {
if (!acceptsGzip) {
cachedResponse.body = unzipSync(cachedResponse.body).toString();
} else {
cachedResponse.headers[CONTENT_ENCODING_HEADER] = 'gzip';
res.setHeader(CONTENT_ENCODING_HEADER, 'gzip');
}
}

res.send(cachedResponse.body);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public SubscriptionResponse subscribeToTopic(SDKClient sdkClient, TopicMessageQu
// allow time for connection to be made and error to be caught
await("responseEncountered")
.atMost(Durations.ONE_MINUTE)
.pollInterval(Durations.ONE_SECOND)
.pollDelay(Durations.ONE_HUNDRED_MILLISECONDS)
.until(() -> subscriptionResponse.hasResponse());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.hedera.mirror.test.e2e.acceptance.client;

import static com.hedera.mirror.test.e2e.acceptance.config.AcceptanceTestProperties.HederaNetwork.OTHER;
import static org.awaitility.Awaitility.await;

import com.google.common.base.Stopwatch;
import com.hedera.hashgraph.sdk.AccountBalanceQuery;
Expand Down Expand Up @@ -49,13 +50,16 @@
import lombok.CustomLog;
import lombok.Getter;
import lombok.Value;
import org.apache.commons.lang3.StringUtils;
import org.awaitility.Durations;
import org.springframework.util.CollectionUtils;

@CustomLog
@Named
@Value
public class SDKClient implements Cleanable {

private static final String RESET_IP = "1.0.0.0";
private static final SecureRandom RANDOM = new SecureRandom();

private final Client client;
Expand Down Expand Up @@ -152,7 +156,13 @@ private Client createClient() throws InterruptedException {

if (acceptanceTestProperties.isRetrieveAddressBook()) {
try {
return toClient(getAddressBook());
log.info("Waiting for a valid address book");
var addressBook = await("retrieveAddressBook")
.atMost(acceptanceTestProperties.getStartupTimeout())
.pollDelay(Duration.ofMillis(100))
.pollInterval(Durations.FIVE_SECONDS)
.until(this::getAddressBook, ab -> !ab.isEmpty());
return toClient(addressBook);
} catch (Exception e) {
log.warn("Error retrieving address book", e);
}
Expand Down Expand Up @@ -283,7 +293,7 @@ private Map<String, AccountId> getAddressBook() {
for (var serviceEndpoint : node.getServiceEndpoints()) {
var ip = serviceEndpoint.getIpAddressV4();
var port = serviceEndpoint.getPort();
if (port == 50211) {
if (port == 50211 && StringUtils.isNotBlank(ip) && !RESET_IP.equals(ip)) {
networkMap.putIfAbsent(ip + ":" + port, accountId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public void createNonFungibleToken(TokenClient.TokenNameEnum tokenName) {
tokenNftInfoMap.put(tokenId, new ArrayList<>());
}

@RetryAsserts
@Given("I ensure token has the correct properties")
public void ensureTokenProperties() {
var tokensResponse = mirrorClient.getTokens(tokenId.toString()).getTokens();
Expand All @@ -144,6 +145,7 @@ public void ensureTokenProperties() {
log.debug("Get token balances for token {}: {}", tokenId, balancesResponse);
}

@RetryAsserts
@Given("I ensure token has the expected metadata and key")
public void ensureTokenInfoProperties() {
var tokenInfo = mirrorClient.getTokenInfo(tokenId.toString());
Expand Down

0 comments on commit 9715335

Please sign in to comment.