• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #19202

06 May 2024 11:11PM CUT coverage: 88.333% (+0.02%) from 88.312%
#19202

push

github

web-flow
buildscripts: simplify PSM interop Kokoro buildscripts (#11121) (#11164)

Integrates the new features of the the Kokoro PSM Interop install library introduced in grpc/psm-interop#73.

Nearly all common functionality was moved from per-language/per-branch PSM Interop build scripts to [psm_interop_kokoro_lib.sh](https://github.com/grpc/psm-interop/blob/main/.kokoro/psm_interop_kokoro_lib.sh):
1. The list of tests in the each test suite 
2. Per-test-suite flag customization
3. `run_test` methods
4. `build_docker_images_if_needed` methods
5. Generic `build_test_app_docker_images` methods (simple docker build + docker push + docker tag). grpc-java is one exception, as it doesn't run docker directly, but a cloudbuild flow.

Now all PSM Interop jobs share the same buildscripts by all test suites:
1.  buildscript that invokes the test: `psm-interop-test-{language}.sh` (configured as `build_file` in the build cfg)
2. buildscript that builds the xDS test client/server and publishes them as a Docker image: `psm-interop-build-{language}.sh` (conventional name called from `psm_interop_kokoro_lib.sh`)

`psm-interop-test-{language}.sh`:
1. Sets `GRPC_LANGUAGE`, `BUILD_SCRIPT_DIR` environment variables.
2. Downloads the shared `psm_interop_kokoro_lib.sh` from the main branch of the psm-interop repo.
3. Sources `psm-interop-build-{language}.sh`
4. Calls `psm::run "${PSM_TEST_SUITE}"` (`PSM_TEST_SUITE` configured in the cfg file).

`psm-interop-build-{language}.sh`:
1. Defines `psm::lang::build_docker_images` which is called from `psm_interop_kokoro_lib.sh`.
2. Invokes any repo-specific logic.
3. May use `psm::build::docker_images_generic` for generic Docker build, tag, push, or provide implement its own build/publish method.

References:
- b/288578634
- See the full list of the new features at grpc/psm-interop#73.
- Additional fixes to the shared lib: grpc/psm-interop#78, grpc/psm-interop#79

30344 of 34352 relevant lines covered (88.33%)

0.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.63
/../netty/src/main/java/io/grpc/netty/ClientTransportLifecycleManager.java
1
/*
2
 * Copyright 2016 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.netty;
18

19
import com.google.errorprone.annotations.CanIgnoreReturnValue;
20
import io.grpc.Status;
21
import io.grpc.internal.ManagedClientTransport;
22

23
/** Maintainer of transport lifecycle status. */
24
final class ClientTransportLifecycleManager {
25
  private final ManagedClientTransport.Listener listener;
26
  private boolean transportReady;
27
  private boolean transportShutdown;
28
  private boolean transportInUse;
29
  /** null iff !transportShutdown. */
30
  private Status shutdownStatus;
31
  /** null iff !transportShutdown. */
32
  private Throwable shutdownThrowable;
33
  private boolean transportTerminated;
34

35
  public ClientTransportLifecycleManager(ManagedClientTransport.Listener listener) {
1✔
36
    this.listener = listener;
1✔
37
  }
1✔
38

39
  public void notifyReady() {
40
    if (transportReady || transportShutdown) {
1✔
41
      return;
×
42
    }
43
    transportReady = true;
1✔
44
    listener.transportReady();
1✔
45
  }
1✔
46

47
  /**
48
   * Marks transport as shutdown, but does not set the error status. This must eventually be
49
   * followed by a call to notifyShutdown.
50
   */
51
  public void notifyGracefulShutdown(Status s) {
52
    if (transportShutdown) {
1✔
53
      return;
1✔
54
    }
55
    transportShutdown = true;
1✔
56
    listener.transportShutdown(s);
1✔
57
  }
1✔
58

59
  /** Returns {@code true} if was the first shutdown. */
60
  @CanIgnoreReturnValue
61
  public boolean notifyShutdown(Status s) {
62
    notifyGracefulShutdown(s);
1✔
63
    if (shutdownStatus != null) {
1✔
64
      return false;
1✔
65
    }
66
    shutdownStatus = s;
1✔
67
    shutdownThrowable = s.asException();
1✔
68
    return true;
1✔
69
  }
70

71
  public void notifyInUse(boolean inUse) {
72
    if (inUse == transportInUse) {
1✔
73
      return;
×
74
    }
75
    transportInUse = inUse;
1✔
76
    listener.transportInUse(inUse);
1✔
77
  }
1✔
78

79
  public void notifyTerminated(Status s) {
80
    if (transportTerminated) {
1✔
81
      return;
×
82
    }
83
    transportTerminated = true;
1✔
84
    notifyShutdown(s);
1✔
85
    listener.transportTerminated();
1✔
86
  }
1✔
87

88
  public Status getShutdownStatus() {
89
    return shutdownStatus;
1✔
90
  }
91

92
  public Throwable getShutdownThrowable() {
93
    return shutdownThrowable;
1✔
94
  }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc