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

Add an automated test for plugin/commands/auto (the development server). #3718

Closed
1 of 3 tasks
aknrdureegaesr opened this issue Oct 17, 2023 · 0 comments · Fixed by #3722
Closed
1 of 3 tasks

Add an automated test for plugin/commands/auto (the development server). #3718

aknrdureegaesr opened this issue Oct 17, 2023 · 0 comments · Fixed by #3722

Comments

@aknrdureegaesr
Copy link
Contributor

Requested Feature: (short description)

In an experiment, I sabotaged the development server and ran the tests. To my dismay, no test failed. This feature request requests coming up with a test for the development server.

In detail, here is what I did:

  • I turned the crucial line webapp.router.register_resource(resource) in the file plugins/command/auto/__init.py__ into a comment.
  • I ran pytest tests/ as recommended by the contributing guidelines.

Expectation: Some tests fail.

Actually seen: The test was happy.

I double-checked that removing that line in an actual Nikola deployment causes the development server to fail miserably; it does not serve the document root (404 HTTP Code).

Related Area: (eg. tasks, compilers, configuration, templates…)

This feature request is not suggesting to change any production code or functionality, but only add material to tests.

Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)

  • Yes, I have already written code for it (link if available and feasible)
  • Yes, I don’t have code ready yet (that’s okay!)
  • No (that’s okay too!)

I have done stuff like that before. My suggestion / plan is:

  • Add some directories with a file each that the server can serve (statically to the git repo).
  • At runtime, open a server port at 127.0.0.1, fetch the port's number, and close it immediately. This yields a port number that is presently unused.
  • Configure the server to use that port and start it.
  • Fire a few HTTP requests from the test code against that port and see the answers are as expected.

Does this feature affect backwards compatibility? If yes, in what way?

No.

Rationale and full description: (why should it be added to Nikola?)

This is somewhat related to #3715. Maybe I'll provide a pull request for that one, too (still have not promised). I have a profound dislike regarding providing a pull request without a test.

aknrdureegaesr added a commit to aknrdureegaesr/nikola that referenced this issue Jan 1, 2024
aknrdureegaesr added a commit to aknrdureegaesr/nikola that referenced this issue Jan 1, 2024
aknrdureegaesr added a commit to aknrdureegaesr/nikola that referenced this issue Jan 1, 2024
aknrdureegaesr added a commit to aknrdureegaesr/nikola that referenced this issue Jan 1, 2024
aknrdureegaesr added a commit to aknrdureegaesr/nikola that referenced this issue Jan 1, 2024
@Kwpolska Kwpolska linked a pull request Jan 1, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant