|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.apache.pekko.actor.typed |
| 19 | + |
| 20 | +import com.typesafe.config.ConfigFactory |
| 21 | +import org.apache.pekko |
| 22 | +import pekko.actor.typed.scaladsl.Behaviors |
| 23 | +import pekko.testkit.PekkoSpec |
| 24 | + |
| 25 | +import scala.annotation.nowarn |
| 26 | + |
| 27 | +@nowarn("msg=possible missing interpolator") |
| 28 | +class ActorSystemSpec extends PekkoSpec { |
| 29 | + "ActorSystem" should { |
| 30 | + "not include username in toString" in { |
| 31 | + // Actor System toString is output to logs and we don't want env variable values appearing in logs |
| 32 | + val system = ActorSystem(Behaviors.empty[String], "config-test-system", |
| 33 | + ConfigFactory |
| 34 | + .parseString("""pekko.test.java.property.home = "${user.home}"""") |
| 35 | + .withFallback(PekkoSpec.testConf)) |
| 36 | + try { |
| 37 | + val debugText = system.settings.toString |
| 38 | + val username = System.getProperty("user.name") |
| 39 | + val userHome = System.getProperty("user.home") |
| 40 | + (debugText should not).include(username) |
| 41 | + (debugText should not).include(userHome) |
| 42 | + debugText should include("<username>") |
| 43 | + } finally { |
| 44 | + system.terminate() |
| 45 | + } |
| 46 | + } |
| 47 | + } |
| 48 | +} |
0 commit comments