Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Adds documentation for new testing functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Thomas <[email protected]>
  • Loading branch information
thomastaylor312 committed Jan 26, 2023
1 parent 318f3a7 commit 8ddb367
Showing 1 changed file with 54 additions and 4 deletions.
58 changes: 54 additions & 4 deletions actor/blobby/actor/README.md → actor/blobby/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
# Blobby

This actor (we like to call it "Little Blobby Tables") is a simple file server showing the basic CRUD operations of the `wasmcloud:blobstore` contract
This actor (we like to call it "Little Blobby Tables") is a simple file server showing the basic
CRUD operations of the `wasmcloud:blobstore` contract.

Not only is this actor an example, it is also a fully-functional, HTTP-based fileserver that can be
fronted with any HTTP server implementation and any blobstore implementation (i.e. you could store
the uploaded files on a filesystem or in an s3 compatible store). It also has a full example of
integration testing for the actor

## Required Capability Claims

1. `wasmcloud:httpserver` to receive http requests
2. `wasmcloud:blobstore` to save the image to a blob
3. `wasmcloud:builtin:logging` so the actor can log

## Running this example

This example requires capability providers that fulfill the above contracts. The wasmCloud [HTTP Server](https://github.com/wasmCloud/capability-providers/tree/main/httpserver-rs) and [Filesystem](https://github.com/wasmCloud/capability-providers/tree/main/blobstore-fs) capability providers implement this functionality but you're welcome to use any implementation (like the [S3 Blobstore](https://github.com/wasmCloud/capability-providers/tree/main/blobstore-s3)).
This example requires capability providers that fulfill the above contracts. The wasmCloud [HTTP
Server](https://github.com/wasmCloud/capability-providers/tree/main/httpserver-rs) and
[Filesystem](https://github.com/wasmCloud/capability-providers/tree/main/blobstore-fs) capability
providers implement this functionality but you're welcome to use any implementation (like the [S3
Blobstore](https://github.com/wasmCloud/capability-providers/tree/main/blobstore-s3)).

Once you've installed **wash** and ran wasmCloud after following the [installation guide](https://wasmcloud.dev/overview/installation/), you can run this example actor and the wasmCloud providers with the following commands:
Once you've installed **wash** and ran wasmCloud after following the [installation
guide](https://wasmcloud.dev/overview/installation/), you can run this example actor and the
wasmCloud providers with the following commands:
```
$ wash ctl start actor wasmcloud.azurecr.io/blobby:0.1.0
# If you use a locally built actor, replace the actor ID below with your own
Expand All @@ -21,7 +34,8 @@ $ wash ctl start provider wasmcloud.azurecr.io/blobstore_fs:0.2.0 --skip-wait
$ wash ctl start provider wasmcloud.azurecr.io/httpserver:0.16.0 --skip-wait
```

Once everything is up and running, you can run through all of the operations by following the annotated commands below:
Once everything is up and running, you can run through all of the operations by following the
annotated commands below:

```console
# Create a file with some content
Expand Down Expand Up @@ -131,3 +145,39 @@ $ curl -v 'http://127.0.0.1:8080/myfile.txt'
<
* Connection #0 to host 127.0.0.1 left intact
```

## Development

This actor has two subdirectories. Due to the actor having a wasm32 target, we couldn't have the
integration tests in the same directory. The `actor` directory contains the actual code for the
actor and the `testing` directory contains the integration tests.

### Prerequisites

This actor requires a working Rust tool chain as well as
[`wash`](https://wasmcloud.dev/overview/installation/)

### Building the actor

Building the actor is fairly straightforward:

```console
$ cd actor
$ wash build
```

### Testing the actor

Testing the actor is just a bit more complex, but still fairly easy

```console
$ cd testing
$ cargo test -- --test-threads 1
```

This will automatically build your actor and then run the tests. The `--test-threads 1` only runs
one test at a time as a workaround until we can put in the work to automatically generate different
ports for everything that is starting up

Please note that these tests are currently being used as a testbed for actor integration testing. It
is likely we will try to wrap this up in some sort of testing tool in the future!

0 comments on commit 8ddb367

Please sign in to comment.