Skip to content

Commit b85f3c8

Browse files
authored
Use master-key in tests suite (#28)
1 parent d193684 commit b85f3c8

File tree

7 files changed

+49
-49
lines changed

7 files changed

+49
-49
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
- name: Build
1919
run: cargo build --verbose
2020
- name: Docker setup
21-
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --no-analytics=true
21+
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --no-analytics=true --master-key=masterKey
2222
- name: Run tests
2323
run: cargo test --verbose -- --test-threads=1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl Document for Book {
5151
#[tokio::main]
5252
async fn main() {
5353
// Create a client (without sending any request so that can't fail)
54-
let client = Client::new("http://localhost:7700", "");
54+
let client = Client::new("http://localhost:7700", "masterKey");
5555

5656
// Get the index called "books"
5757
let mut books = client.get_or_create("books").await.unwrap();

src/client.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<'a> Client<'a> {
2222
/// # use meilisearch_sdk::{client::*, indexes::*};
2323
/// #
2424
/// // create the client
25-
/// let client = Client::new("http://localhost:7700", "");
25+
/// let client = Client::new("http://localhost:7700", "masterKey");
2626
/// ```
2727
pub const fn new(host: &'a str, apikey: &'a str) -> Client<'a> {
2828
Client { host, apikey }
@@ -37,7 +37,7 @@ impl<'a> Client<'a> {
3737
/// # #[tokio::main]
3838
/// # async fn main() {
3939
/// // create the client
40-
/// let client = Client::new("http://localhost:7700", "");
40+
/// let client = Client::new("http://localhost:7700", "masterKey");
4141
///
4242
/// let indexes: Vec<Index> = client.list_all_indexes().await.unwrap();
4343
/// println!("{:?}", indexes);
@@ -69,7 +69,7 @@ impl<'a> Client<'a> {
6969
/// # #[tokio::main]
7070
/// # async fn main() {
7171
/// // create the client
72-
/// let client = Client::new("http://localhost:7700", "");
72+
/// let client = Client::new("http://localhost:7700", "masterKey");
7373
/// # client.create_index("movies", None).await;
7474
///
7575
/// // get the index named "movies"
@@ -104,7 +104,7 @@ impl<'a> Client<'a> {
104104
/// # #[tokio::main]
105105
/// # async fn main() {
106106
/// // create the client
107-
/// let client = Client::new("http://localhost:7700", "");
107+
/// let client = Client::new("http://localhost:7700", "masterKey");
108108
///
109109
/// # if let Ok(mut movies) = client.get_index("movies").await {
110110
/// # movies.delete().await.unwrap();
@@ -164,7 +164,7 @@ impl<'a> Client<'a> {
164164
/// #
165165
/// # #[tokio::main]
166166
/// # async fn main() {
167-
/// let client = Client::new("http://localhost:7700", "");
167+
/// let client = Client::new("http://localhost:7700", "masterKey");
168168
/// let stats = client.get_stats().await.unwrap();
169169
/// # }
170170
/// ```
@@ -186,7 +186,7 @@ impl<'a> Client<'a> {
186186
/// #
187187
/// # #[tokio::main]
188188
/// # async fn main() {
189-
/// let client = Client::new("http://localhost:7700", "");
189+
/// let client = Client::new("http://localhost:7700", "masterKey");
190190
///
191191
/// match client.get_health().await {
192192
/// Ok(()) => println!("server is operationnal"),
@@ -217,7 +217,7 @@ impl<'a> Client<'a> {
217217
/// #
218218
/// # #[tokio::main]
219219
/// # async fn main() {
220-
/// let client = Client::new("http://localhost:7700", "");
220+
/// let client = Client::new("http://localhost:7700", "masterKey");
221221
///
222222
/// client.set_health(false).await.unwrap();
223223
/// # client.set_health(true).await.unwrap();
@@ -250,7 +250,7 @@ impl<'a> Client<'a> {
250250
/// #
251251
/// # #[tokio::main]
252252
/// # async fn main() {
253-
/// let client = Client::new("http://localhost:7700", "");
253+
/// let client = Client::new("http://localhost:7700", "masterKey");
254254
/// let version = client.get_version().await.unwrap();
255255
/// # }
256256
/// ```

src/indexes.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl JsonIndex {
3131
/// # use meilisearch_sdk::{client::*, indexes::*};
3232
/// # #[tokio::main]
3333
/// # async fn main() {
34-
/// let client = Client::new("http://localhost:7700", "");
34+
/// let client = Client::new("http://localhost:7700", "masterKey");
3535
///
3636
/// // get the index called movies or create it if it does not exist
3737
/// let movies = client.get_or_create("movies").await.unwrap();
@@ -67,7 +67,7 @@ impl<'a> Index<'a> {
6767
/// # use meilisearch_sdk::{client::*, indexes::*};
6868
/// # #[tokio::main]
6969
/// # async fn main() {
70-
/// let client = Client::new("http://localhost:7700", "");
70+
/// let client = Client::new("http://localhost:7700", "masterKey");
7171
/// # client.create_index("movies", None).await;
7272
///
7373
/// // get the index named "movies" and delete it
@@ -107,7 +107,7 @@ impl<'a> Index<'a> {
107107
///
108108
/// # #[tokio::main]
109109
/// # async fn main() {
110-
/// let client = Client::new("http://localhost:7700", "");
110+
/// let client = Client::new("http://localhost:7700", "masterKey");
111111
/// let mut movies = client.get_or_create("movies").await.unwrap();
112112
///
113113
/// // add some documents
@@ -163,7 +163,7 @@ impl<'a> Index<'a> {
163163
///
164164
/// # #[tokio::main]
165165
/// # async fn main() {
166-
/// let client = Client::new("http://localhost:7700", "");
166+
/// let client = Client::new("http://localhost:7700", "masterKey");
167167
/// # client.create_index("movies", None).await;
168168
/// let movies = client.get_index("movies").await.unwrap();
169169
/// # let mut movies = client.get_index("movies").await.unwrap();
@@ -222,7 +222,7 @@ impl<'a> Index<'a> {
222222
///
223223
/// # #[tokio::main]
224224
/// # async fn main() {
225-
/// let client = Client::new("http://localhost:7700", "");
225+
/// let client = Client::new("http://localhost:7700", "masterKey");
226226
/// # client.create_index("movies", None).await;
227227
/// let movie_index = client.get_index("movies").await.unwrap();
228228
/// # let mut movie_index = client.get_index("movies").await.unwrap();
@@ -297,7 +297,7 @@ impl<'a> Index<'a> {
297297
///
298298
/// # #[tokio::main]
299299
/// # async fn main() {
300-
/// let client = Client::new("http://localhost:7700", "");
300+
/// let client = Client::new("http://localhost:7700", "masterKey");
301301
/// let mut movie_index = client.get_or_create("movies").await.unwrap();
302302
///
303303
/// movie_index.add_or_replace(&[
@@ -385,7 +385,7 @@ impl<'a> Index<'a> {
385385
///
386386
/// # #[tokio::main]
387387
/// # async fn main() {
388-
/// let client = Client::new("http://localhost:7700", "");
388+
/// let client = Client::new("http://localhost:7700", "masterKey");
389389
/// let mut movie_index = client.get_or_create("movies").await.unwrap();
390390
///
391391
/// movie_index.add_or_update(&[
@@ -454,7 +454,7 @@ impl<'a> Index<'a> {
454454
/// # #[tokio::main]
455455
/// # async fn main() {
456456
/// #
457-
/// let client = Client::new("http://localhost:7700", "");
457+
/// let client = Client::new("http://localhost:7700", "masterKey");
458458
/// let mut movie_index = client.get_or_create("movies").await.unwrap();
459459
///
460460
/// // add some documents
@@ -499,7 +499,7 @@ impl<'a> Index<'a> {
499499
/// # #[tokio::main]
500500
/// # async fn main() {
501501
/// #
502-
/// let client = Client::new("http://localhost:7700", "");
502+
/// let client = Client::new("http://localhost:7700", "masterKey");
503503
/// let mut movies = client.get_or_create("movies").await.unwrap();
504504
///
505505
/// # movies.add_or_replace(&[Movie{name:String::from("Interstellar"), description:String::from("Interstellar chronicles the adventures of a group of explorers who make use of a newly discovered wormhole to surpass the limitations on human space travel and conquer the vast distances involved in an interstellar voyage.")}], Some("name")).await.unwrap();
@@ -547,7 +547,7 @@ impl<'a> Index<'a> {
547547
/// # #[tokio::main]
548548
/// # async fn main() {
549549
/// #
550-
/// let client = Client::new("http://localhost:7700", "");
550+
/// let client = Client::new("http://localhost:7700", "masterKey");
551551
/// let mut movies = client.get_or_create("movies").await.unwrap();
552552
///
553553
/// // add some documents
@@ -588,7 +588,7 @@ impl<'a> Index<'a> {
588588
/// #
589589
/// # #[tokio::main]
590590
/// # async fn main() {
591-
/// let client = Client::new("http://localhost:7700", "");
591+
/// let client = Client::new("http://localhost:7700", "masterKey");
592592
/// let movies = client.get_or_create("movies").await.unwrap();
593593
///
594594
/// let stats = movies.get_stats().await.unwrap();

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
//! #[tokio::main]
4747
//! async fn main() {
4848
//! // Create a client (without sending any request so that can't fail)
49-
//! let client = Client::new("http://localhost:7700", "");
49+
//! let client = Client::new("http://localhost:7700", "masterKey");
5050
//!
5151
//! // Get the index called "books"
5252
//! let mut books = client.get_or_create("books").await.unwrap();

src/progress.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl<'a> Progress<'a> {
3434
/// # use meilisearch_sdk::{client::*, indexes::*, document::*};
3535
/// # #[tokio::main]
3636
/// # async fn main() {
37-
/// let client = Client::new("http://localhost:7700", "");
37+
/// let client = Client::new("http://localhost:7700", "masterKey");
3838
/// let mut movies_index = client.get_or_create("movies").await.unwrap();
3939
/// let progress = movies_index.delete_all_documents().await.unwrap();
4040
/// let status = progress.get_status().await.unwrap();

0 commit comments

Comments
 (0)