Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CargoITCase #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

olenagerasimova
Copy link
Member

Part of #8
Added GitSlice to cargo main entry point, integration test and test logging config.

@olenagerasimova olenagerasimova requested a review from g4s8 December 27, 2021 08:45
@olenagerasimova
Copy link
Member Author

@g4s8 here is the IT, it's failing now as cargo fails to parse response from InfoRefsSlice with response with error:

Container.ExecResult(exitCode=101, stdout=, stderr=    Updating `artipie` index
warning: spurious network error (2 tries remaining): error parsing REF pkt-line; class=Net (12)
warning: spurious network error (1 tries remaining): error parsing REF pkt-line; class=Net (12)
error: failed to update registry `artipie`

Caused by:
  failed to fetch `http://host.testcontainers.internal:64911/`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  error parsing REF pkt-line; class=Net (12)
)

@g4s8
Copy link
Member

g4s8 commented Dec 27, 2021

@olenagerasimova I have another stack-trace here:

[ERROR] Failures: 
[ERROR]   CargoITCase.canPush:98 
Expected: a string containing "Upload successful", "http://host.testcontainers.internal" in order
     but: was "Container.ExecResult(exitCode=101, stdout=, stderr=    Updating `artipie` index
warning: spurious network error (2 tries remaining): failed to receive HTTP 200 response: got 404; class=Net (12)
warning: spurious network error (1 tries remaining): failed to receive HTTP 200 response: got 404; class=Net (12)
error: failed to update registry `artipie`

Caused by:
  failed to fetch `http://host.testcontainers.internal:42391/`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  failed to receive HTTP 200 response: got 404; class=Net (12)
)"

it seems GitSlice was not called in this test. Also, I checked HTTP flow, all /info-refs requests has 404 responses

@olenagerasimova
Copy link
Member Author

@g4s8 hm, I do not see how is that possible and why. Logs from the actions are the same as my. What is the request paths? You should be able to see it in logs

@olenagerasimova
Copy link
Member Author

@g4s8 any update?

@olenagerasimova
Copy link
Member Author

@g4s8 did you take a look? Any updates?

Copy link
Member

@g4s8 g4s8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olenagerasimova sorry for delay, please check some comments


@BeforeEach
void init() throws IOException {
final int port = new RandomFreePort().get();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just get it from final int port = this.server.start()

@@ -20,6 +21,7 @@
class CargoSliceTest {

@Test
@Disabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this test is now disabled?

@olenagerasimova
Copy link
Member Author

@g4s8 the test is not working as cargo cannot parse the response from git-adapter while performing GET /info/refs?service=git-upload-pack request:

Result:
Container.ExecResult(exitCode=101, stdout=, stderr=    Updating `artipie` index
warning: spurious network error (2 tries remaining): error parsing REF pkt-line; class=Net (12)
warning: spurious network error (1 tries remaining): error parsing REF pkt-line; class=Net (12)
error: failed to update registry `artipie`

do you have any ideas why?

@g4s8
Copy link
Member

g4s8 commented Jan 19, 2022

@olenagerasimova needs more details here. I'm not sure if cargo respsects git env variables but we can try running it with env GIT_TRACE=true GIT_TRACE=true cargo publish ...

@olenagerasimova
Copy link
Member Author

@g4s8 by default cargo uses built-in git library, not system git executable. I've installed git and made cargo use it instead of built-in git library, also set GIT_TRACE=true into env, here if the full log:

[DEBUG] main com.artipie.cargo.http.CargoITCase: Command:
git --version
Result:
Container.ExecResult(exitCode=0, stdout=git version 2.30.2
, stderr=14:33:45.237739 git.c:444               trace: built-in: git version
)
[DEBUG] main com.artipie.cargo.http.CargoITCase: Command:
cargo version
Result:
Container.ExecResult(exitCode=0, stdout=cargo 1.56.0 (4ed5d137b 2021-10-04)
, stderr=)
[DEBUG] main com.artipie.cargo.http.CargoITCase: Command:
cargo new hello_world
Result:
Container.ExecResult(exitCode=0, stdout=, stderr=     Created binary (application) `hello_world` package
)
[DEBUG] vert.x-eventloop-thread-0 com.artipie.cargo.http.CargoSlice: >> GET /info/refs?service=git-upload-pack HTTP_1_1

Host: host.testcontainers.internal:60578
User-Agent: git/2.30.2
Accept: */*
Accept-Encoding: deflate, gzip, br
Pragma: no-cache
Git-Protocol: version=2
[DEBUG] vert.x-eventloop-thread-0 com.artipie.cargo.http.CargoSlice: << OK
Content-Length: 173
Content-Type: application/x-git-upload-pack-advertisement
[DEBUG] vert.x-eventloop-thread-0 com.artipie.cargo.http.CargoSlice: >> POST /git-upload-pack HTTP_1_1

Host: host.testcontainers.internal:60578
User-Agent: git/2.30.2
Accept-Encoding: deflate, gzip, br
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Git-Protocol: version=2
content-length: 294
[DEBUG] ForkJoinPool.commonPool-worker-3 com.artipie.cargo.http.CargoSlice: << OK
Content-Length: 4
[DEBUG] main com.artipie.cargo.http.CargoITCase: Command:
cargo publish --verbose --manifest-path ./hello_world/Cargo.toml
Result:
Container.ExecResult(exitCode=101, stdout=, stderr=    Updating `artipie` index
     Running `git fetch --force --update-head-ok 'http://host.testcontainers.internal:60578/' 'HEAD:refs/remotes/origin/HEAD'`
error: failed to update registry `artipie`

Caused by:
  failed to fetch `http://host.testcontainers.internal:60578/`

Caused by:
  process didn't exit successfully: `git fetch --force --update-head-ok 'http://host.testcontainers.internal:60578/' 'HEAD:refs/remotes/origin/HEAD'` (exit status: 128)
  --- stderr
  14:33:46.840087 git.c:444               trace: built-in: git fetch --force --update-head-ok http://host.testcontainers.internal:60578/ HEAD:refs/remotes/origin/HEAD
  14:33:46.841176 run-command.c:664       trace: run_command: git remote-http http://host.testcontainers.internal:60578/ http://host.testcontainers.internal:60578/
  14:33:46.844640 git.c:730               trace: exec: git-remote-http http://host.testcontainers.internal:60578/ http://host.testcontainers.internal:60578/
  14:33:46.844751 run-command.c:664       trace: run_command: git-remote-http http://host.testcontainers.internal:60578/ http://host.testcontainers.internal:60578/
  fatal: couldn't find remote ref HEAD
)

please, check actions for details.

@g4s8
Copy link
Member

g4s8 commented Feb 9, 2022

@olenagerasimova working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants