Skip to content

Commit b89582b

Browse files
Merge branch 'main' into update/sbt-scalajs-1.13.2
2 parents 8c29f04 + 0277c72 commit b89582b

File tree

13 files changed

+76
-73
lines changed

13 files changed

+76
-73
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ b8564609df3c849b3a258a411e0de645d4e8c7a0
55
# Code formatting (PR: #950)
66
ccd98e22a078e1282dbb2c1acfb40fe3afee01b6
77

8+
9+
# Scala Steward: Reformat with scalafmt 3.7.6
10+
79da8216cac0c6ec8b2d6340c1980674fdd273aa

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=3.7.4
1+
version=3.7.6
22
maxColumn = 120
33
assumeStandardLibraryStripMargin = true
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.0
1+
sbt.version=1.9.1

examples/commands-leveldb/src/test/scala/CommandsLevelDB.scala

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import org.fusesource.leveldbjni.JniDBFactory._
88
import scala.util.{Try, Success}
99
import scala.collection.immutable.Map
1010

11-
1211
object CommandsLevelDB extends org.scalacheck.Properties("CommandsLevelDB") {
1312

1413
property("leveldbspec") = LevelDBSpec.property()
@@ -18,28 +17,26 @@ object CommandsLevelDB extends org.scalacheck.Properties("CommandsLevelDB") {
1817
object LevelDBSpec extends Commands {
1918

2019
case class State(
21-
open: Boolean,
22-
name: String,
23-
contents: Map[List[Byte],List[Byte]]
20+
open: Boolean,
21+
name: String,
22+
contents: Map[List[Byte], List[Byte]]
2423
)
2524

2625
case class Sut(
27-
var name: String,
28-
var db: DB
26+
var name: String,
27+
var db: DB
2928
) {
3029
def path = s"db_$name"
3130
}
3231

33-
def canCreateNewSut(newState: State, initSuts: Traversable[State],
34-
runningSuts: Traversable[Sut]
35-
) = {
32+
def canCreateNewSut(newState: State, initSuts: Traversable[State], runningSuts: Traversable[Sut]) = {
3633
!initSuts.exists(_.name == newState.name) &&
3734
!runningSuts.exists(_.name == newState.name)
3835
}
3936

4037
def newSut(state: State): Sut = Sut(state.name, null)
4138

42-
def destroySut(sut: Sut) = if(sut.db != null) sut.db.close
39+
def destroySut(sut: Sut) = if (sut.db != null) sut.db.close
4340

4441
def initialPreCondition(state: State) = !state.open
4542

@@ -57,13 +54,12 @@ object LevelDBSpec extends Commands {
5754
genGetExisting(state)
5855
)
5956

60-
val genPut: Gen[Put] = Gen.resultOf(Put(_,_))
57+
val genPut: Gen[Put] = Gen.resultOf(Put(_, _))
6158

6259
def genPutExisting(state: State): Gen[Put] = for {
6360
key <- Gen.oneOf(state.contents.keys.toSeq)
64-
value <- Gen.oneOf(arbitrary[List[Byte]],
65-
Gen.const(state.contents(key)))
66-
} yield Put(key,value)
61+
value <- Gen.oneOf(arbitrary[List[Byte]], Gen.const(state.contents(key)))
62+
} yield Put(key, value)
6763

6864
val genGet: Gen[Get] = Gen.resultOf(Get(_))
6965

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.0
1+
sbt.version=1.9.1

examples/commands-nix/src/test/scala/CommandsNix.scala

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.scalacheck.Gen
22
import org.scalacheck.commands.Commands
33

4-
import util.{Try,Success,Failure}
4+
import util.{Try, Success, Failure}
55

66
object CommandsNix extends org.scalacheck.Properties("CommandsNix") {
77

@@ -13,14 +13,14 @@ object MachineSpec extends Commands {
1313

1414
val con = new org.libvirt.Connect("qemu:///session")
1515

16-
def runSshCmd(ip: String, cmd: String): Either[String,String] = {
16+
def runSshCmd(ip: String, cmd: String): Either[String, String] = {
1717
import scala.sys.process._
1818
val err = new StringBuffer()
1919
val logger = ProcessLogger(err.append(_))
2020

2121
val sshcmd =
2222
s"ssh -q -i test-key_rsa -l root -o UserKnownHostsFile=/dev/null " +
23-
s"-o StrictHostKeyChecking=no -o ConnectTimeout=1 ${ip}"
23+
s"-o StrictHostKeyChecking=no -o ConnectTimeout=1 ${ip}"
2424

2525
if (s"$sshcmd true" ! logger != 0)
2626
throw new Exception(err.toString)
@@ -55,10 +55,10 @@ object MachineSpec extends Commands {
5555
prefixLength = 24;
5656
};
5757
boot.kernelPackages =
58-
pkgs.linuxPackages_${m.kernelVer.replace('.','_')};
58+
pkgs.linuxPackages_${m.kernelVer.replace('.', '_')};
5959
"""
6060

61-
def toLibvirtXMLs(machines: State): Map[String,String] = {
61+
def toLibvirtXMLs(machines: State): Map[String, String] = {
6262
import scala.sys.process._
6363
import java.io.ByteArrayInputStream
6464

@@ -74,23 +74,23 @@ object MachineSpec extends Commands {
7474

7575
// Check that all expected output files can be read
7676
xmlFiles.values foreach { f =>
77-
if(!(new java.io.File(f)).canRead) throw new Exception(raw"""
77+
if (!(new java.io.File(f)).canRead) throw new Exception(raw"""
7878
No Libvirt XML produced (${f})
7979
out = ${out.toString}
8080
err = ${err.toString}
8181
""")
8282
}
8383

84-
xmlFiles map { case (id,f) => id -> io.Source.fromFile(f).mkString }
84+
xmlFiles map { case (id, f) => id -> io.Source.fromFile(f).mkString }
8585
}
8686

87-
case class Machine (
88-
id: String,
89-
uuid: java.util.UUID,
90-
ip: String,
91-
kernelVer: String,
92-
memory: Int,
93-
running: Boolean
87+
case class Machine(
88+
id: String,
89+
uuid: java.util.UUID,
90+
ip: String,
91+
kernelVer: String,
92+
memory: Int,
93+
running: Boolean
9494
)
9595

9696
// Machine.id mapped to a machine state
@@ -100,12 +100,10 @@ object MachineSpec extends Commands {
100100
type Sut = Map[String, org.libvirt.Domain]
101101

102102
// TODO we should check for example total amount of memory used here
103-
def canCreateNewSut(newState: State, initSuts: Traversable[State],
104-
runningSuts: Traversable[Sut]
105-
): Boolean = true
103+
def canCreateNewSut(newState: State, initSuts: Traversable[State], runningSuts: Traversable[Sut]): Boolean = true
106104

107105
def newSut(state: State): Sut = {
108-
toLibvirtXMLs(state) map { case (id,xml) => id -> con.domainDefineXML(xml) }
106+
toLibvirtXMLs(state) map { case (id, xml) => id -> con.domainDefineXML(xml) }
109107
}
110108

111109
def destroySut(sut: Sut) = sut.values foreach { d =>
@@ -121,22 +119,22 @@ object MachineSpec extends Commands {
121119

122120
// generate a 10.x.y subnet
123121
val genSubnet: Gen[List[Int]] = for {
124-
x <- Gen.choose(0,255)
125-
y <- Gen.choose(0,255)
126-
} yield List(10,x,y)
122+
x <- Gen.choose(0, 255)
123+
y <- Gen.choose(0, 255)
124+
} yield List(10, x, y)
127125

128126
def hasDuplicates(xs: Seq[Any]): Boolean = xs.distinct.length != xs.length
129127

130128
def genMachine(id: String, subnet: List[Int]): Gen[Machine] = for {
131129
uuid <- Gen.uuid
132-
//ip <- Gen.choose(2,254).map(n => (subnet :+ n).mkString("."))
133-
ip <- Gen.choose(2,254).map(n => s"172.16.2.$n")
130+
// ip <- Gen.choose(2,254).map(n => (subnet :+ n).mkString("."))
131+
ip <- Gen.choose(2, 254).map(n => s"172.16.2.$n")
134132
memory <- Gen.choose(96, 256)
135133
kernel <- Gen.oneOf("3.14", "3.13", "3.12", "3.10")
136-
} yield Machine (id, uuid, ip, kernel, memory, false)
134+
} yield Machine(id, uuid, ip, kernel, memory, false)
137135

138136
val genInitialState: Gen[State] = for {
139-
machineCount <- Gen.choose(5,5)
137+
machineCount <- Gen.choose(5, 5)
140138
idGen = Gen.listOfN(8, Gen.alphaLowerChar).map(_.mkString)
141139
ids <- Gen.listOfN(machineCount, idGen)
142140
subnet <- genSubnet
@@ -162,8 +160,8 @@ object MachineSpec extends Commands {
162160
)
163161

164162
def genCommand(state: State): Gen[Command] =
165-
if(state.forall(!_.running)) genBoot(state)
166-
else if(state.forall(_.running)) Gen.frequency(
163+
if (state.forall(!_.running)) genBoot(state)
164+
else if (state.forall(_.running)) Gen.frequency(
167165
(1, genShutdown(state)),
168166
(4, genPingOnline(state))
169167
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.0
1+
sbt.version=1.9.1

examples/commands-redis/src/test/scala/CommandsRedis.scala

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import org.scalacheck.Gen
2-
import org.scalacheck.Gen.{someOf, oneOf, const, nonEmptyListOf,
3-
identifier, frequency}
2+
import org.scalacheck.Gen.{someOf, oneOf, const, nonEmptyListOf, identifier, frequency}
43
import org.scalacheck.Arbitrary.arbitrary
54
import org.scalacheck.commands.Commands
65

@@ -10,7 +9,6 @@ import scala.collection.Seq
109

1110
import com.redis.RedisClient
1211

13-
1412
object CommandsRedis extends org.scalacheck.Properties("CommandsRedis") {
1513

1614
property("redisspec") = RedisSpec.property()
@@ -21,15 +19,13 @@ object RedisSpec extends Commands {
2119

2220
type Sut = RedisClient
2321

24-
case class State (
25-
contents: collection.immutable.Map[String,String],
26-
deleted: collection.immutable.Set[String],
27-
connected: Boolean
22+
case class State(
23+
contents: collection.immutable.Map[String, String],
24+
deleted: collection.immutable.Set[String],
25+
connected: Boolean
2826
)
2927

30-
def canCreateNewSut(newState: State, initSuts: Traversable[State],
31-
runningSuts: Traversable[Sut]
32-
): Boolean = {
28+
def canCreateNewSut(newState: State, initSuts: Traversable[State], runningSuts: Traversable[Sut]): Boolean = {
3329
initSuts.isEmpty && runningSuts.isEmpty
3430
}
3531

@@ -55,7 +51,7 @@ object RedisSpec extends Commands {
5551
)
5652

5753
def genCommand(state: State): Gen[Command] = {
58-
if(!state.connected) ToggleConnected
54+
if (!state.connected) ToggleConnected
5955
else
6056
frequency(
6157
(20, genDel),
@@ -66,13 +62,13 @@ object RedisSpec extends Commands {
6662
(20, genGetExisting(state)),
6763
(20, genGetDeleted(state)),
6864
(20, const(DBSize)),
69-
( 1, const(FlushDB)),
70-
( 3, const(ToggleConnected))
65+
(1, const(FlushDB)),
66+
(3, const(ToggleConnected))
7167
)
7268
}
7369

74-
//val genKey = arbitrary[String]
75-
//val genVal = arbitrary[String]
70+
// val genKey = arbitrary[String]
71+
// val genVal = arbitrary[String]
7672
val genKey = identifier
7773
val genVal = identifier
7874

@@ -82,30 +78,32 @@ object RedisSpec extends Commands {
8278
} yield Set(key, value)
8379

8480
def genDelExisting(state: State): Gen[Del] =
85-
if(state.contents.isEmpty) genDel
81+
if (state.contents.isEmpty) genDel
8682
else someOf(state.contents.keys.toSeq).map(Del.apply)
8783

8884
def genSetExisting(state: State): Gen[Set] =
89-
if(state.contents.isEmpty) genSet else for {
85+
if (state.contents.isEmpty) genSet
86+
else for {
9087
key <- oneOf(state.contents.keys.toSeq)
9188
value <- oneOf(genVal, const(state.contents(key)))
92-
} yield Set(key,value)
89+
} yield Set(key, value)
9390

9491
val genGet: Gen[Get] = genKey.map(Get.apply)
9592

9693
val genDel: Gen[Del] = nonEmptyListOf(genKey).map(Del.apply)
9794

9895
def genGetExisting(state: State): Gen[Get] =
99-
if(state.contents.isEmpty) genGet else for {
96+
if (state.contents.isEmpty) genGet
97+
else for {
10098
key <- oneOf(state.contents.keys.toSeq)
10199
} yield Get(key)
102100

103101
def genGetDeleted(state: State): Gen[Get] =
104-
if(state.deleted.isEmpty) genGet else for {
102+
if (state.deleted.isEmpty) genGet
103+
else for {
105104
key <- oneOf(state.deleted.toSeq)
106105
} yield Get(key)
107106

108-
109107
case object DBSize extends Command {
110108
type Result = Option[Long]
111109
def run(sut: Sut) = sut.dbsize
@@ -130,7 +128,7 @@ object RedisSpec extends Commands {
130128
case class Del(keys: Seq[String]) extends Command {
131129
type Result = Option[Long]
132130
def run(sut: Sut) =
133-
if(keys.isEmpty) Some(0)
131+
if (keys.isEmpty) Some(0)
134132
else sut.del(keys.head, keys.tail.toSeq: _*)
135133
def preCondition(state: State) = state.connected
136134
def nextState(state: State) = state.copy(
@@ -155,7 +153,7 @@ object RedisSpec extends Commands {
155153
case object ToggleConnected extends Command {
156154
type Result = Boolean
157155
def run(sut: Sut) = {
158-
if(sut.connected) sut.quit
156+
if (sut.connected) sut.quit
159157
else sut.connect
160158
}
161159
def preCondition(state: State) = true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.0
1+
sbt.version=1.9.1
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1")
2-

0 commit comments

Comments
 (0)