mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
nixos/tests/meilisearch: fix curl invocation
Also replace the movies dataset with a direct download as it is not present in newer meilisearch versions. Link the NixOS test to the package.
This commit is contained in:
parent
8cb2a61de4
commit
19e4234f4c
@ -5,9 +5,10 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
|
||||
apiUrl = "http://${listenAddress}:${toString listenPort}";
|
||||
uid = "movies";
|
||||
indexJSON = pkgs.writeText "index.json" (builtins.toJSON { inherit uid; });
|
||||
moviesJSON = pkgs.runCommand "movies.json" {} ''
|
||||
sed -n '1,5p;$p' ${pkgs.meilisearch.src}/datasets/movies/movies.json > $out
|
||||
'';
|
||||
moviesJSON = pkgs.fetchurl {
|
||||
url = "https://github.com/meilisearch/meilisearch/raw/v0.23.1/datasets/movies/movies.json";
|
||||
sha256 = "1r3srld63dpmg9yrmysm6xl175661j5cspi93mk5q2wf8xwn50c5";
|
||||
};
|
||||
in {
|
||||
name = "meilisearch";
|
||||
meta.maintainers = with lib.maintainers; [ Br1ght0ne ];
|
||||
@ -34,7 +35,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
|
||||
|
||||
with subtest("create index"):
|
||||
machine.succeed(
|
||||
"curl -XPOST ${apiUrl}/indexes --data @${indexJSON}"
|
||||
"curl -XPOST --header 'Content-Type: application/json' ${apiUrl}/indexes --data @${indexJSON}"
|
||||
)
|
||||
indexes = json.loads(machine.succeed("curl ${apiUrl}/indexes"))
|
||||
assert len(indexes) == 1, "index wasn't created"
|
||||
@ -42,7 +43,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
|
||||
with subtest("add documents"):
|
||||
response = json.loads(
|
||||
machine.succeed(
|
||||
"curl -XPOST ${apiUrl}/indexes/${uid}/documents --data @${moviesJSON}"
|
||||
"curl -XPOST --header 'Content-Type: application/json' ${apiUrl}/indexes/${uid}/documents --data @${moviesJSON}"
|
||||
)
|
||||
)
|
||||
update_id = response["updateId"]
|
||||
|
@ -5,6 +5,7 @@
|
||||
, Security
|
||||
, DiskArbitration
|
||||
, Foundation
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
let version = "0.23.1";
|
||||
@ -25,6 +26,9 @@ rustPlatform.buildRustPackage {
|
||||
];
|
||||
cargoSha256 = "sha256-dz+1IQZRSeMEagI2dnOtR3A8prg4UZ2Om0pd1BUhuhE=";
|
||||
buildInputs = lib.optionals stdenv.isDarwin [ Security DiskArbitration Foundation ];
|
||||
passthru.tests = {
|
||||
meilisearch = nixosTests.meilisearch;
|
||||
};
|
||||
meta = with lib; {
|
||||
description = "Powerful, fast, and an easy to use search engine ";
|
||||
homepage = "https://docs.meilisearch.com/";
|
||||
|
Loading…
Reference in New Issue
Block a user