Skip to content

Commit

Permalink
debug port not readyz
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Jan 23, 2025
1 parent d7c4771 commit d50e565
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 42 deletions.
63 changes: 29 additions & 34 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ OCIS_FED_DOMAIN = "%s:10200" % FED_OCIS_SERVER_NAME
# configuration
config = {
"cs3ApiTests": {
"skip": False,
"skip": True,
},
"wopiValidatorTests": {
"skip": False,
"skip": True,
},
"k6LoadTests": {
"skip": False,
"skip": True,
},
"localApiTests": {
"basic": {
Expand All @@ -89,13 +89,13 @@ config = {
"apiLocks",
"apiActivities",
],
"skip": False,
"skip": True,
},
"settings": {
"suites": [
"apiSettings",
],
"skip": False,
"skip": True,
"withRemotePhp": [True],
"emailNeeded": True,
"extraEnvironment": {
Expand All @@ -113,7 +113,6 @@ config = {
},
"graph": {
"suites": [
"apiGraph",
"apiServiceAvailability",
],
"skip": False,
Expand All @@ -123,62 +122,62 @@ config = {
"suites": [
"apiGraphUserGroup",
],
"skip": False,
"skip": True,
"withRemotePhp": [True],
},
"spaces": {
"suites": [
"apiSpaces",
],
"skip": False,
"skip": True,
},
"spacesShares": {
"suites": [
"apiSpacesShares",
],
"skip": False,
"skip": True,
},
"spacesDavOperation": {
"suites": [
"apiSpacesDavOperation",
],
"skip": False,
"skip": True,
},
"search1": {
"suites": [
"apiSearch1",
],
"skip": False,
"skip": True,
},
"search2": {
"suites": [
"apiSearch2",
],
"skip": False,
"skip": True,
},
"sharingNg": {
"suites": [
"apiReshare",
"apiSharingNg1",
"apiSharingNg2",
],
"skip": False,
"skip": True,
},
"sharingNgShareInvitation": {
"suites": [
"apiSharingNgShareInvitation",
],
"skip": False,
"skip": True,
},
"sharingNgLinkShare": {
"suites": [
"apiSharingNgLinkSharePermission",
"apiSharingNgLinkShareRoot",
],
"skip": False,
"skip": True,
},
"accountsHashDifficulty": {
"skip": False,
"skip": True,
"suites": [
"apiAccountsHashDifficulty",
],
Expand All @@ -188,7 +187,7 @@ config = {
"suites": [
"apiNotification",
],
"skip": False,
"skip": True,
"withRemotePhp": [True],
"emailNeeded": True,
"extraEnvironment": {
Expand All @@ -208,7 +207,7 @@ config = {
"suites": [
"apiAntivirus",
],
"skip": False,
"skip": True,
"antivirusNeeded": True,
"extraServerEnvironment": {
"ANTIVIRUS_SCANNER_TYPE": "clamav",
Expand All @@ -223,14 +222,14 @@ config = {
"suites": [
"apiSearchContent",
],
"skip": False,
"skip": True,
"tikaNeeded": True,
},
"ocm": {
"suites": [
"apiOcm",
],
"skip": False,
"skip": True,
"withRemotePhp": [True],
"federationServer": True,
"emailNeeded": True,
Expand All @@ -256,7 +255,7 @@ config = {
"suites": [
"apiCollaboration",
],
"skip": False,
"skip": True,
"collaborationServiceNeeded": True,
"extraServerEnvironment": {
"GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
Expand All @@ -266,7 +265,7 @@ config = {
"suites": [
"apiAuthApp",
],
"skip": False,
"skip": True,
"withRemotePhp": [True],
"extraServerEnvironment": {
"OCIS_ADD_RUN_SERVICES": "auth-app",
Expand All @@ -277,7 +276,7 @@ config = {
"suites": [
"cliCommands",
],
"skip": False,
"skip": True,
"withRemotePhp": [True],
"antivirusNeeded": True,
"extraServerEnvironment": {
Expand All @@ -290,24 +289,24 @@ config = {
},
"apiTests": {
"numberOfParts": 7,
"skip": False,
"skip": True,
"skipExceptParts": [],
},
"e2eTests": {
"part": {
"skip": False,
"skip": True,
"totalParts": 4, # divide and run all suites in parts (divide pipelines)
"xsuites": ["search", "app-provider", "oidc", "ocm"], # suites to skip
},
"search": {
"skip": False,
"skip": True,
"suites": ["search"], # suites to run
"tikaNeeded": True,
},
},
"e2eMultiService": {
"testSuites": {
"skip": False,
"skip": True,
"suites": [
"smoke",
"shares",
Expand All @@ -330,8 +329,8 @@ config = {
"dockerReleases": {
"architectures": ["arm64", "amd64"],
},
"litmus": True,
"codestyle": True,
"litmus": False,
"codestyle": False,
}

# volume for steps to cache Go dependencies between steps of a pipeline
Expand Down Expand Up @@ -422,14 +421,10 @@ def main(ctx):

test_pipelines = \
codestyle(ctx) + \
checkGherkinLint(ctx) + \
checkTestSuitesInExpectedFailures(ctx) + \
buildWebCache(ctx) + \
getGoBinForTesting(ctx) + \
buildOcisBinaryForTesting(ctx) + \
checkStarlark() + \
build_release_helpers + \
testOcisAndUploadResults(ctx) + \
testPipelines(ctx)

build_release_pipelines = \
Expand All @@ -443,7 +438,7 @@ def main(ctx):
),
)

pipelines = test_pipelines + build_release_pipelines
pipelines = test_pipelines

if ctx.build.event == "cron":
pipelines = \
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/bootstrap/OcisConfigContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function theConfigHasBeenSetToValue(TableNode $table): void {
*/
public function theAdministratorHasStartedServiceSeparately(string $service): void {
$response = OcisConfigHelper::startService($service);

var_dump($response->getBody()->getContents());
Assert::assertEquals(
200,
$response->getStatusCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ Feature: service health check

@env-config
Scenario: check services readiness while running separately
Given the administrator has started service "audit" separately
Given the administrator has started service "auth-app" separately
When a user requests these URLs with "GET" and no authentication
| endpoint | service |
| http://%base_url_hostname%:9229/readyz | audit |
| endpoint | service |
| http://%base_url_hostname%:9245/readyz | auth-app |
Then the HTTP status code of responses on all endpoints should be "200"
8 changes: 4 additions & 4 deletions tests/ociswrapper/ocis/ocis.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ func StartService(service string, envMap []string) {

for listService, pid := range runningServices {
log.Println(fmt.Sprintf("%s service started with process id %v", listService, pid))
WaitUntilPortListens(listService)
}

// Read the logs when the 'ocis server' command is running
Expand Down Expand Up @@ -364,8 +363,9 @@ func StopService(service string) (bool, string) {

var servicePortMap = map[string]int{
"ocis": 9250,
"audit": 9229,
"audit": 9290,
"activitylog": 9197,
"auth-app": 9245,
}

// WaitUntilPortListens waits until the port for a given service is listening
Expand All @@ -388,14 +388,14 @@ func WaitUntilPortListens(service string) bool {
return false
case <-ticker.C:
address := fmt.Sprintf(":%d", port)
log.Println(fmt.Sprintf("Address %s\n", address))
// Try to connect to the port
conn, err := net.DialTimeout("tcp", address, 1*time.Second)
if err == nil {
_ = conn.Close()
log.Println(fmt.Sprintf("%s service is ready", service))
log.Println(fmt.Sprintf("%s service is ready to listen port %d", service, port))
return true
}
log.Println(fmt.Sprintf("%v port is not ready %v\n", conn, err))
}
}
}
2 changes: 2 additions & 0 deletions tests/ociswrapper/wrapper/handlers/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"ociswrapper/common"
"ociswrapper/ocis"
"time"
)

type BasicResponse struct {
Expand Down Expand Up @@ -234,6 +235,7 @@ func OcisServiceHandler(res http.ResponseWriter, req *http.Request) {

success := ocis.WaitUntilPortListens(serviceName)
if success {
time.Sleep(30 * time.Second)
sendResponse(res, http.StatusOK, fmt.Sprintf("oCIS service %s started successfully", serviceName))
} else {
sendResponse(res, http.StatusInternalServerError, fmt.Sprintf("Failed to start oCIS service %s", serviceName))
Expand Down

0 comments on commit d50e565

Please sign in to comment.