Skip to content

Commit

Permalink
fix tests i
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarquezp committed Nov 14, 2024
1 parent 71aa9a8 commit 62dd45f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ public org.threeten.bp.Instant getExpireTime() {

/** Get the expire time of this backup. */
public java.time.Instant getExpireTimeInstant() {
return java.time.Instant.ofEpochMilli(Timestamps.toMillis(proto.getExpireTime()));
// return java.time.Instant.ofEpochMilli(Timestamps.toMillis(proto.getExpireTime()));
return java.time.Instant.ofEpochSecond(
proto.getExpireTime().getSeconds(), proto.getExpireTime().getNanos());
}

/** This method is obsolete. Use {@link #getStartTimeInstant()} instead. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.cloud.bigtable.admin.v2.internal.NameUtil;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.protobuf.util.Timestamps;
import com.google.protobuf.Timestamp;
import javax.annotation.Nonnull;

/** Build CopyBackupRequest for {@link com.google.bigtable.admin.v2.CopyBackupRequest}. */
Expand Down Expand Up @@ -85,7 +85,12 @@ public CopyBackupRequest setExpireTime(org.threeten.bp.Instant expireTime) {

public CopyBackupRequest setExpireTimeInstant(java.time.Instant expireTime) {
Preconditions.checkNotNull(expireTime);
requestBuilder.setExpireTime(Timestamps.fromMillis(expireTime.toEpochMilli()));
Timestamp value =
Timestamp.newBuilder()
.setSeconds(expireTime.getEpochSecond())
.setNanos(expireTime.getNano())
.build();
requestBuilder.setExpireTime(value);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ public ChangeStreamRecord onCloseStream(ReadChangeStreamResponse.CloseStream clo
return CloseStream.fromProto(closeStream);
}

/** {@inheritDoc} */
@Override
public void startUserMutationInstant(
@Nonnull ByteString rowKey,
@Nonnull String sourceClusterId,
java.time.Instant commitTimestamp,
int tieBreaker) {
this.changeStreamMutationBuilder =
ChangeStreamMutation.createUserMutation(
rowKey, sourceClusterId, commitTimestamp, tieBreaker);
}

/** {@inheritDoc} */
@Override
public void startUserMutation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,11 @@ public void testCopyBackup() {
.setSourceBackup(srcBackupName)
.setStartTime(startTime)
.setEndTime(endTime)
.setExpireTime(Timestamps.fromMillis(expireTime.toEpochMilli()))
.setExpireTime(
Timestamp.newBuilder()
.setSeconds(expireTime.getEpochSecond())
.setNanos(expireTime.getNano())
.build())
.setSizeBytes(sizeBytes)
.build(),
CopyBackupMetadata.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private void verifySettings(
assertThat(settings.getEndpoint()).isEqualTo(endpoint);
assertThat(settings.getCredentialsProvider()).isEqualTo(credentialsProvider);
assertThat(settings.getStreamWatchdogProvider()).isSameInstanceAs(watchdogProvider);
assertThat(settings.getStreamWatchdogCheckInterval()).isEqualTo(watchdogInterval);
assertThat(settings.getStreamWatchdogCheckIntervalDuration()).isEqualTo(watchdogInterval);
assertThat(settings.getEnableRoutingCookie()).isEqualTo(enableRoutingCookie);
assertThat(settings.getEnableRetryInfo()).isEqualTo(enableRetryInfo);
assertThat(settings.getMetricsEndpoint()).isEqualTo(metricsEndpoint);
Expand Down

0 comments on commit 62dd45f

Please sign in to comment.