Skip to content

tests seem to pick up wrong base url #251

@butonic

Description

@butonic

While working on #256 I ran into this...

When trying to run LOCAL_TEST=true ./tests/acceptance/run_api_tests.sh some tests seem to pick up the wrong hostname, eg.:

Scenario Outline: search for the shared folder when the share is not accepted # /home/jfd/Repositories/opencloud/tests/acceptance/features/apiContract/spacesSharesReport.feature:78
    Given using <dav-path-version> DAV path                                     # FeatureContext::usingOldOrNewOrSpacesDavPath()
    And user "Brian" has disabled auto-accepting                                # SettingsContext::theUserHasDisabledAutoAccepting()
    And user "Alice" has sent the following resource share invitation:          # SharingNgContext::userHasSentTheFollowingResourceShareInvitation()
      | resource        | folderMain |
      | space           | find data  |
      | sharee          | Brian      |
      | shareType       | user       |
      | permissionsRole | Viewer     |
    When user "Brian" searches for "folderMain" using the WebDAV API            # SearchContext::userSearchesUsingWebDavAPI()
    Then the HTTP status code should be "207"                                   # FeatureContext::thenTheHTTPStatusCodeShouldBe()
    And the following headers should match these regular expressions            # FeatureContext::theFollowingHeadersShouldMatchTheseRegularExpressions()
      | X-Request-Id | %request_id_pattern% |
    And the search result should contain "0" entries                            # FeatureContext::propfindResultShouldContainNumEntries()

    Examples:
      | dav-path-version |
      | old              |
        Failed step: And the following headers should match these regular expressions
        '/^redacted\/.*$/' does not match '37b6d363e943/uY5LJ5QU2p-000690'
        Failed asserting that false is not false.
      | new              |
        Failed step: And the following headers should match these regular expressions
        '/^redacted\/.*$/' does not match '37b6d363e943/uY5LJ5QU2p-000759'
        Failed asserting that false is not false.
      | spaces           |
        Failed step: And the following headers should match these regular expressions
        '/^redacted\/.*$/' does not match '37b6d363e943/uY5LJ5QU2p-000828'
        Failed asserting that false is not false.

while redacted is the actual hostname the tests seem to expect the docker container hostname 37b6d363e943:

❯ docker ps
CONTAINER ID   IMAGE                                         COMMAND                  CREATED          STATUS                    PORTS                                                                                                                             NAMES
c673262b11e7   inbucket/inbucket                             "/start-inbucket.sh …"   10 minutes ago   Up 10 minutes (healthy)   1100/tcp, 2500/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp                                                                     opencloud-acceptance-tests-email-1
92fb2ddc8862   apache/tika:2.8.0.0                           "/bin/sh -c 'exec ja…"   10 minutes ago   Up 10 minutes             9998/tcp                                                                                                                          opencloud-acceptance-tests-tika-1
37b6d363e943   opencloud-acceptance-tests-opencloud-server   "serve-opencloud"        10 minutes ago   Up 10 minutes             0.0.0.0:5200->5200/tcp, :::5200->5200/tcp, 0.0.0.0:9174->9174/tcp, :::9174->9174/tcp, 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp   opencloud-acceptance-tests-opencloud-server-1

the FeatureContext.php uses PHPs getBaseURL to substitute the %base_url%:

public function substituteInLineCodes(
		?string $value,
		?string $user = null,
		?array  $functions = [],
		?array  $additionalSubstitutions = [],
		?string $group = null,
		?string $userName = null
	): ?string {
		$substitutions = [
			[
				"code" => "%base_url%",
				"function" => [
					$this,
					"getBaseUrl"
				],
				"parameter" => []
			],
   // [...]

the tests does make requests from host redacted ... but ... hmmm

🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions