Skip to content

Commit

Permalink
Fix FileNotFoundException: ~.maestro/sessions (#1843)
Browse files Browse the repository at this point in the history
* fix FileNotFoundException: ~.maestro/sessions

* update versions and changelog
  • Loading branch information
bartekpacia authored Jul 29, 2024
1 parent 487793c commit d40b1cb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
24 changes: 21 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
# Changelog

## 1.37.3 - 2024-07-29

### Bug fixes

Fix `FileNotFoundException: ~.maestro/sessions` ([#1843](https://github.com/mobile-dev-inc/maestro/pull/1843))

## 1.37.2 - 2024-07-29

### Bug fixes

- Fix `UnsupportedOperationException: Empty collection can't be reduced` ([#1840](https://github.com/mobile-dev-inc/maestro/pull/1840))

## 1.37.1 - 2024-07-29

### Bug fixes

- Fix crash when `flutter` or `xcodebuild` is not installed ([#1839](https://github.com/mobile-dev-inc/maestro/pull/1839))

## 1.37.0 - 2024-07-29

### New features

- **Sharding tests for parallel execution on many devices 🎉** ([#1732](https://github.com/mobile-dev-inc/maestro/pull/1732) by [Kaan](https://github.com/sdfgsdfgd))
- **Sharding tests for parallel execution on many devices 🎉** ([#1732](https://github.com/mobile-dev-inc/maestro/pull/1732) by [Kaan](https://github.com/sdfgsdfgd))

You can now pass `--shards` argument to `maestro test` to split up your test suite into chunks that run in parallel. If you have feedback or suggestions about this huge new feature, please share them with us in [issue #1818](https://github.com/mobile-dev-inc/maestro/issues/1818).

- **Reports in HTML** ([#1750](https://github.com/mobile-dev-inc/maestro/pull/1750) by [Depa Panjie Purnama](https://github.com/depapp))
- **Reports in HTML** ([#1750](https://github.com/mobile-dev-inc/maestro/pull/1750) by [Depa Panjie Purnama](https://github.com/depapp))

To see it, run `maestro test --format HTML <your-flow.yaml>`

- **Homebrew is back!**
- **Homebrew is back!**

If you prefer to switch your installation of Maestro to use Homebrew:
1. `rm -rf ~/.maestro`
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
GROUP=dev.mobile
VERSION_NAME=1.37.2
VERSION_NAME=1.37.3
POM_DESCRIPTION=Maestro is a server-driven platform-agnostic library that allows to drive tests for both iOS and Android using the same implementation through an intuitive API.
POM_URL=https://github.com/mobile-dev-inc/maestro
POM_SCM_URL=https://github.com/mobile-dev-inc/maestro
Expand Down
2 changes: 1 addition & 1 deletion maestro-cli/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CLI_VERSION=1.37.2
CLI_VERSION=1.37.3
6 changes: 5 additions & 1 deletion maestro-cli/src/main/java/maestro/cli/db/KeyValueStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import kotlin.concurrent.write
class KeyValueStore(private val dbFile: File) {
private val lock = ReentrantReadWriteLock()

init {
dbFile.createNewFile()
}

fun get(key: String): String? = lock.read { getCurrentDB()[key] }

fun set(key: String, value: String) = lock.write {
Expand Down Expand Up @@ -40,4 +44,4 @@ class KeyValueStore(private val dbFile: File) {
.joinToString("\n")
)
}
}
}
14 changes: 5 additions & 9 deletions maestro-cli/src/main/java/maestro/cli/session/SessionStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ object SessionStore {

private val keyValueStore by lazy {
KeyValueStore(
Paths
.get(
System.getProperty("user.home"),
".maestro",
"sessions"
)
dbFile = Paths
.get(System.getProperty("user.home"), ".maestro", "sessions")
.toFile()
.also { it.parentFile.mkdirs() }
)
Expand All @@ -23,8 +19,8 @@ object SessionStore {
fun heartbeat(sessionId: String, platform: Platform) {
synchronized(keyValueStore) {
keyValueStore.set(
key(sessionId, platform),
System.currentTimeMillis().toString()
key = key(sessionId, platform),
value = System.currentTimeMillis().toString(),
)

pruneInactiveSessions()
Expand Down Expand Up @@ -74,4 +70,4 @@ object SessionStore {
return "${platform}_$sessionId"
}

}
}

0 comments on commit d40b1cb

Please sign in to comment.