Browse Source

Add documentation to work with feed snapshots (#4598)

Alexis Degrugillier 3 years ago
parent
commit
60e723435e
2 changed files with 55 additions and 3 deletions
  1. 40 0
      docs/en/developers/03_Running_tests.md
  2. 15 3
      docs/en/developers/06_Reporting_Bugs.md

+ 40 - 0
docs/en/developers/03_Running_tests.md

@@ -34,3 +34,43 @@ They are performed with [GitHub Actions](https://github.com/FreshRSS/FreshRSS/ac
 This ensures your code will not introduce some kind of regression. We will not merge a PR if tests fail so we will ask you to fix any bugs before reviewing your code.
 
 If you are interested, you can take a look at [the configuration file](https://github.com/FreshRSS/FreshRSS/blob/edge/.github/workflows/tests.yml).
+
+## Using feed snapshots
+
+As feed data is volatile, it’s better to work with snapshots when debugging some issues.
+You can find the description to retrieve a snapshot [here](06_Reporting_Bugs.md#how-to-provide-feed-data).
+
+To serve those snapshots, you can use a mock server.
+Here we will demonstrate how to work with [WireMock](https://wiremock.org/) but other solutions exist.
+Here are the steps to start using the WireMock mock server:
+
+1. Go to the mock server home folder.
+If you do not have one, you need to create one.
+1. Inside the mock server home folder, create the ___file_ and _mappings_ folders.
+1. Copy or move your snapshots in the ___file_ folder.
+1. Create the _feed.json_ file in the _mappings_ folder with the following content:
+	```js
+	{
+		"request": {
+			"method": "GET",
+			"urlPathPattern": "/.*"
+		},
+		"response": {
+			"status": 200,
+			"bodyFileName": "{{request.pathSegments.[0]}}",
+			"transformers": ["response-template"],
+			"headers": {
+				"Content-Type": "application/rss+xml"
+			}
+		}
+	}
+	```
+1. Launch the containerized server with the following command:
+	```bash
+	# <PORT> is the port used on the host to communicate with the server
+	# <NETWORK> is the name of the docker network used (by default, it’s freshrss-network)
+	docker run -it --rm -p <PORT>:8080 --name wiremock --network <NETWORK> -v $PWD:/home/wiremock wiremock/wiremock:latest-alpine --local-response-templating
+	```
+1. You can access the `<RSS>` mock file directly:
+   * from the host by sending a GET request to `http://localhost:<PORT>/<RSS>`,
+   * from any container connected on the same network by sending a GET request to `http://wiremock:8080/<RSS>`.

+ 15 - 3
docs/en/developers/06_Reporting_Bugs.md

@@ -33,9 +33,11 @@ Here are some tips to help you present your bug report or suggestion:
 * **Give an explicit title to your request**, even if it’s a bit long. This not only helps us understand your request, but also to find your ticket later.
 * **One request = one ticket.** You may have lots of ideas while being afraid to spam the bug manager: it doesn’t matter. It’s better to have a few too many tickets than too many requests in one. We’ll close and consolidate requests when possible.
 * If you report a bug, think about **providing us with the FreshRSS logs** (accessible in the FreshRSS `data/log/` folder) and the **PHP logs** (the location may vary by distribution, but consider searching in `/var/log/httpd` or `/var/log/apache`).
-* If you can’t find the log files, specify it in your ticket so we know you’ve already searched.
-* Not all bugs require logs, but if you have any doubts, it is better to provide them to us. Logs are important and very useful for debugging!
-* The logs may reveal confidential information, so **be careful not to disclose anything sensitive.**
+  * If you can’t find the log files, specify it in your ticket so we know you’ve already searched.
+  * Not all bugs require logs, but if you have any doubts, it is better to provide them to us. Logs are important and very useful for debugging!
+  * The logs may reveal confidential information, so **be careful not to disclose anything sensitive.**
+* If you report a feed problem, it will be easier if you could provide a snapshot of its content in a text file.
+See [here](#how-to-provide-feed-data) for more information.
 
 In addition, when facing a bug, you’re encouraged to follow this message format (from the [Sam & Max website](http://sametmax.com/template-de-demande-daide-en-informatique/):
 
@@ -64,3 +66,13 @@ Remember to give the following information if you know it:
 3. Which version of PHP?
 4. Which database: SQLite, MySQL, MariaDB, PostgreSQL? Which version?
 5. Which distribution runs on the server? And… which version?
+
+## How to provide feed data
+
+If you need us to investigate a feed problem, it will be easier if you provide a snapshot of the feed data.
+To do that, you can launch the following command:
+
+```bash
+wget <feed url> -O output.rss.txt
+```
+Then you can drag-and-drop the generated file into the issue.